Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StorageReference.putFile completion never called (if file errors) #2350

Closed
simonbengtsson opened this issue Feb 5, 2019 · 7 comments
Closed

StorageReference.putFile completion never called (if file errors) #2350

simonbengtsson opened this issue Feb 5, 2019 · 7 comments
Assignees

Comments

@simonbengtsson
Copy link

@simonbengtsson simonbengtsson commented Feb 5, 2019

  • Xcode version: 10.1
  • Firebase SDK version: 5.16
  • Firebase Component: Storage
  • Component version: 3.1.0

When using StorageReference.putFile errors such as "no such file" gets silenced and the completion block is never called.

Relevant Code/Steps to reproduce

let localFile = URL(string: "non/existing/file/url")!
let ref = Storage.storage().reference(withPath: "folder/file")
ref.putFile(from: localFile, metadata: nil) { metadata, error in
    print("I would expect this to be called with an error but it never does")
}

At first glance it seems like #1888 is related, but there it seemed like people had troubles uploading existing files as well.

@maksymmalyhin
Copy link
Contributor

@maksymmalyhin maksymmalyhin commented Feb 28, 2019

Note: The same issue happens when the file ULR points to an empty file.

@maksymmalyhin
Copy link
Contributor

@maksymmalyhin maksymmalyhin commented Feb 28, 2019

BTW, I am not sure if uploading an empty file makes sense here... @ryanwilson @schmidt-sebastian, Do you think it does?

It looks like we can throw a validation error in case of the empty file as well, then the issue can be closed by a single PR in the Firebase repo, so GTMSessionUploadFetcher can be fixed later.

@schmidt-sebastian
Copy link
Member

@schmidt-sebastian schmidt-sebastian commented Mar 1, 2019

I don't think we should reject empty files. After all, this API is going to be user with user-provided files and we should handle all file sizes gracefully for our developers. Supporting empty files is certainly not a high priority but we should support it in the long term.

schmidt-sebastian added a commit that referenced this issue Mar 4, 2019
* FIRStorageUploadTask: validate data and fileURL before upload (#2350)

* FIRStorageReferenceTests: Verify a specific error (#2350)

* Code cleanup. More informative error.

* FIRStorageReference: error message, test fix (#2350)

* Run ./scripts/style.sh

* #2350: Punctuation

* FIRStorageReferenceTests: naming (#2350)

* Run ./scripts/style.sh

* Tests fixed (#2350)

* FIRStorageReferenceTests fixed for Mac OS (#2350)

* FIRStorageUploadTask: validate content just before uploading (#2350)
@Black-riddle
Copy link

@Black-riddle Black-riddle commented Mar 29, 2019

Is anyone facing the same problem even when the file is not empty (an image in my case)
PS: I am
Using Firebase (5.14.0)
Using FirebaseAuth (5.2.0)
Using FirebaseAuthInterop (1.0.0)
Using FirebaseCore (5.1.9)
Using FirebaseStorage (3.0.3)

@maksymmalyhin
Copy link
Contributor

@maksymmalyhin maksymmalyhin commented Mar 29, 2019

@Black-riddle your Firebase looks a bit old. Would it be possible to test your issue with Firebase
5.19.0?

@Black-riddle
Copy link

@Black-riddle Black-riddle commented Mar 29, 2019

@maksymmalyhin Thank you now it works :)

@morganchen12 morganchen12 removed their assignment Jun 20, 2019
@maksymmalyhin
Copy link
Contributor

@maksymmalyhin maksymmalyhin commented Mar 18, 2020

The issue should be completely fixed by the fix of google/gtm-session-fetcher#140

@firebase firebase locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants