Closed matt-at-allera closed 4 weeks ago
Hi @matt-at-allera Thanks for raising the issue, apologies for the inconvenience the library has caused.
Below are a few questions to help us troubleshoot the issue
Storage.put
fails with no error thrown are there any network errors observed ? Storage.put
requests might be fired when the device is offline ?Hi @matt-at-allera Thanks for raising the issue, apologies for the inconvenience the library has caused.
Below are a few questions to help us troubleshoot the issue
- When
Storage.put
fails with no error thrown are there any network errors observed ?- Does the issue happen intermittently ? Is it possible the failed
Storage.put
requests might be fired when the device is offline ?- Could you elaborate on the file sizes that are being uploaded ?
- Is the issue occurring in all devices or would it be specific to Mobile (example browser on IPad) as mentioned on the issue
Hi @ashwinkumar6, thanks for the response & great questions.
Another finding that we encountered last night is that there were a few missing images in s3. We came back to look at the images again, and they were present after an hour or so. This could mean that they are unintentionally stuck in queue via the offline-mode or the Storage module had serious delays in uploading the file. Could there be backoff issues at play?
Hi @matt-at-allera Thanks for the detailed response !!
If the device is offline from the service-worker's perspective, it will block it with a 503. I would assume that if this is the case, the Storage.put would fail / throw an error from the 503. Is that not the case? Does storage.put upload asynchronously?
In this case when the device is offline would the service worker still make the Storage.put
API calls. In case this API is called i'm wondering if we can extract the network errors. The storage module does not have a retry mechanism which would try to re-upload incase it fails. So Storage.put
should be generating network errors when the device is offline.
We came back to look at the images again, and they were present after an hour or so. This could mean that they are unintentionally stuck in queue via the offline-mode or the Storage module had serious delays in uploading the file.
Does the service worker use any Background Synchronization API to handle tasks in offline mode. I'm wondering if this is eventually firing any PutObject service network calls (the underlying service call Storage.put
makes) once the device comes back online.
Does this issue occur outside the use-case of a service worker? It would be pretty helpful if you could also provide a sample app with this setup to help reproduce. Could you also try upgrading to V6 if possible and check if you're still facing this issue?
@matt-at-allera, wanted to ping you and see if you had a chance to review @ashwinkumar6's comment above. Let us know if you're still blocked by this! Thanks.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Storage
Amplify Version
v5
Amplify Categories
auth, storage, function, api, hosting
Backend
Amplify CLI
Environment information
Describe the bug
Storage.put seemingly does not always complete the file upload process even if it returns the s3 file path as a key.
For the past week or so, when uploading images via Storage.put, we are seeing increased frequency of the image never making it to S3. The result of
await Storage.put(...
(example below) does output akey
(s3 file path) as expected, but if I go to that location in our specified S3 bucket, the image isn't actually there. The block of code that invokesStorage.put
is surrounded in a try/catch, so no error is thrown.When accessing the missing image via
Storage.get
, the request throws a 403: Forbidden. I am presuming this is because there is not file to be accessed there.Expected behavior
I would expect that if the
Storage.put
command returns a valid key and does not throw an error, that the image files will always be present in S3 when searched for.Reproduction steps
Exact reproduction is difficult
Storage.put(...
Storage.get(...
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
Additional configuration
No response
Mobile Device
IPad
Mobile Operating System
No response
Mobile Browser
Chrome
Mobile Browser Version
No response
Additional information and screenshots
No response