I am trying to do a simple Storage.put into a mocked S3 bucket.
I have set everything up server-side already.
amplify add api
amplify add auth
amplify add storage
and I have pushed all of this to AWS and it works fine during testing.
When I run amplify mock storage the aws_config files are re-written as they should be to send all requests to the local mock storage and API.
However, inspecting the network requests shows that the mock S3 bucket it hosted on http://localhost:20005 (no SSL) and the request is sent to https://localhost:20005 (with SSL)
Even if I run my server with npm start or ($env:HTTPS="true") -and (npm start) it still does not successfuly run the Storage.put
The flag in the aws_config file is automatically set so that it should bypass this already:
"aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing": true,
The errors I receive are the following:
[ERROR] 42:36.732 axios-http-handler Error: Network Error
at createError (createError.js:16)
at XMLHttpRequest.handleError (xhr.js:81)
[WARN] 42:36.733 AWSS3Provider - error uploading Error: Network Error
at createError (createError.js:16)
at XMLHttpRequest.handleError (xhr.js:81)
Error: Network Error
at createError (createError.js:16)
at XMLHttpRequest.handleError (xhr.js:81)
Does anyone have any idea what the problem is here?
Look like there are bugs in running amplify mock for storage. What I did is as follows:-
amplify push (Update your local changes to the cloud)expo, yarn start or expo startamplify mock. Note that, when running your app, you're connecting directly to the cloud not with the mock data.
The bug might be with the amplify mock.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With