I recently upgraded from an older version of aws-amplify to version
"aws-amplify": "^1.0.2"
and when doing so I immediately started getting errors when trying to upload to my bucket.
[WARN] 38:42.445 StorageClass - error uploading": CredentialsError: "Missing credentials in config"
After some digging I discovered that some new keys were added to the Storage configuration in the most recent version of aws-amplify; "credentials" and "level". The documentation does not mentioned these in any way, and I am unable to find exactly what value this "credentials" key needs in order to work properly (with a manual configuration of Auth and Storage). Anyone have any ideas of what this credentials object should look like?
You do not need to set the credentials key manually, the Amplify is setting the credentials for the Storage class automatically. Since your environment was working prior the update the issue maybe related with aws-sdk
packages. The issue is related with multiple aws-sdk
packages in your node_modules
folder. As a rule simple removing an aws-sdk
folder is not working since your project files are cached. Below are steps how to fix the issue for a react-native
project but you can adjust them according to your environment:
Make sure you do not have aws-sdk
under dependencies in your package.json
file since aws-amplify
already has AWS SDK included. If there is an aws-sdk
in the package.json
file run the command to remove it:
$ npm uninstall aws-sdk --save
Make sure you are using the latest version of aws-amplify
package.
Remove the package-lock.json
file from your project folder (do not forget to create a copy of the file).
Run
$ rm -rf node_modules && npm install
This command will remove your node_modules
folder and reinstall all the packages according to the package.json
file.
Optionally you can clear your local caches by entering one-by-one the following commands:
$ watchman watch-del-all
$ rm -rf /tmp/haste-map-react-native-packager-*
$ rm -rf /tmp/metro-bundler-cache-*
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