Open benwimpory opened 1 year ago
Hi @benwimpory thanks for opening this issue. amplify mock storage
doesn't work with amplfy-flutter unfortunately.
I did some digging of how amplify-js and iOS, Android work with the mock, it looks like amplify-flutter missing a piece to detect the mock mode and override underlying service API endpoint with the local mock endpoint, and Amplify CLI cannot modify amplifyconfiguration.dart
correctly atm.
Would missing local mock capability be a blocker for your work while Amplify offers developer environment support which should be able to cover general development cycle.
Thanks for the quick reply on this.
It's good to have had confirmation this is an unsupported feature rather than me doing something wrong! A small note on the documentation may save others hours of time trying to make this feature work.
It's not an outright blocker but defintely an inconvenience as I travel a lot and am often without a stable internet connection so cannot use developer environment support. It's also far quicker to developer using mocks (as I've found with GQL API mocking) due to latency. I can write my own fake provider classes to simulate amplify S3 interactions until this issue is fixed.
Would it be possible to extend the flutter s3 plugin to accept the local http storage endpoint URI so I (and others) could manually maintain a separate amplifyconfiguration.dart for local development ? Having the CLI upgraded to automatically switch the configuration would then be a lower priority.
Thanks for the follow @benwimpory .
Adding implementation to support local mock in the stable version of the s3 plugin would be cumbersome as the functionality depends on amplify-ios and amplify-android, it should be easier to implement in the next releases which the packages are written in Dart. I'll see how we can prioritize this, and update here if any progress. Thanks for your patience.
Summary of items that may be needed to support amplify mock storage
:
amplifyconfiguration.dart
on amplify mock storage
http
with the local mock mode (if this would be a problem blocking testing) Related to https://github.com/aws-amplify/amplify-cli/issues/11493 in CLI repo
After further review the configurations provided by the CLI are sufficient for the Flutter library to consume and connect to the localhost address. Transferring to Flutter
We've marked this as a feature request for the Storage library. We will update this ticket when we have more information.
Description
Flutter s3 storage plugin throws 404 exceptions when uploading or downloading files when using
amplify mock storage
on ios simulator.If I close the
amplify mock storage
process and re-run against a real AWS endpoint, S3 uploads and downloads work perfectly from my flutter app.In both cases, the app is successfully authenticating with a real cognito backend.
I have done an amplify push, edited the Info.plist file as per the amplify mocking documentation.
The flutter exception I get when either uploading or downloading is the same.
Categories
Steps to Reproduce
amplify mock storage
Screenshots
No response
Platforms
Android Device/Emulator API Level
No response
Environment
Dependencies
Device
iphone 13
OS
ios 15.1
Deployment Method
Amplify CLI
CLI Version
10.5.1
Additional Context
No response
Amplify Config