Configure AWS Amplify

Thx for following up. I used "aws-amplify": "^2.3.0",. Seems like I’m using an old version!

If it helps, here’s my github repo: [Github](https://github.com/tkim90/tkim90-serverless-stack-frontend).

Yeah give it a try with the newer one. They updated it to split up all the sub-packages.

I want to echo how helpful this site has been to building a successful project. This is incredible. Thank-you.

I have a question around the Amplify configuration.

In Serverless, I am deploying different environments to different accounts to completely isolate my dev, staging, and prod environments. However, config.js hardcodes the key-value pairs for the backend services. Any ideas on how you can create environment specific configurations?

1 Like

@dalejacques, they address this later in the tutorial. Check it out here: https://serverless-stack.com/chapters/manage-environments-in-create-react-app.html

1 Like

I didn’t have any issues with my app for a while but started getting

TypeError: Cannot read property 'clientMetadata' of undefined

when trying to log in after building. This was only after code bundling for some reason. I found adding Auth.configure() along with Amplify.configure() fixed the problem. I am using “aws-amplify”: “^3.0.8” vs the guides “aws-amplify”: “^3.0.6”. See https://github.com/aws-amplify/amplify-js/issues/4411.

Not sure if how relevant this is but it took me some time to figure out and might be helpful to someone else.

That’s weird. Where did you add this line?

Index.js in the frontend. The exact same section where you run Amplify.configure().

1 Like

After doing “npm install aws-amplify --save”, npm reports "30 low severity vulnerabilities.
Of course, “npm audit fix” does not help. It looks like there are some modules that depend on an older version of “node-fetch” that has a security vulnerability. Updating “node-fetch” does not fix them though. Any clues?

npm audit report

node-fetch <=2.6.0 || 3.0.0-beta.1 - 3.0.0-beta.8
Denial of Service - The `size` option isn't honored after following a redirect in node-fetch · CVE-2020-15168 · GitHub Advisory Database · GitHub
fix available via npm audit fix
node_modules/isomorphic-fetch/node_modules/node-fetch
isomorphic-fetch 2.0.0 - 2.2.1
Depends on vulnerable versions of node-fetch
node_modules/isomorphic-fetch
fbjs 0.7.0 - 1.0.0
Depends on vulnerable versions of isomorphic-fetch
node_modules/fbjs
metro 0.22.1 - 0.63.0
Depends on vulnerable versions of fbjs
Depends on vulnerable versions of metro-config
node_modules/metro
@react-native-community/cli <=5.0.0-alpha.0
Depends on vulnerable versions of metro
Depends on vulnerable versions of react-native
node_modules/@aws-sdk/middleware-retry/node_modules/@react-native-community/cli
react-native <=0.0.0-851d01b0a || 0.0.0-87d000f89 - 0.0.0-949dedca9 || 0.0.0-965635f07 - 0.0.0-ffdfbbec0 || 0.22.0-rc - 0.64.0-rc.0
Depends on vulnerable versions of @react-native-community/cli
Depends on vulnerable versions of fbjs
node_modules/@aws-sdk/middleware-retry/node_modules/react-native
react-native-get-random-values *
Depends on vulnerable versions of react-native
node_modules/@aws-sdk/middleware-retry/node_modules/react-native-get-random-values
@aws-sdk/middleware-retry >=1.0.0-gamma.2
Depends on vulnerable versions of react-native-get-random-values
node_modules/@aws-sdk/middleware-retry
@aws-sdk/client-cognito-identity >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-cognito-identity
@aws-amplify/core >=3.4.3-unstable.9
Depends on vulnerable versions of @aws-sdk/client-cognito-identity
node_modules/@aws-amplify/core
@aws-amplify/api-graphql >=1.1.3-unstable.9
Depends on vulnerable versions of @aws-amplify/core
node_modules/@aws-amplify/api-graphql
@aws-amplify/api-rest >=1.1.3-unstable.9
Depends on vulnerable versions of @aws-amplify/core
node_modules/@aws-amplify/api-rest
@aws-amplify/api >=3.1.20-unstable.9
Depends on vulnerable versions of @aws-amplify/api-rest
node_modules/@aws-amplify/api
@aws-amplify/auth >=3.3.2-unstable.9
Depends on vulnerable versions of @aws-amplify/core
node_modules/@aws-amplify/auth
@aws-amplify/cache >=3.1.20-unstable.9
Depends on vulnerable versions of @aws-amplify/core
node_modules/@aws-amplify/cache
@aws-amplify/datastore >=2.2.7-unstable.9
Depends on vulnerable versions of @aws-amplify/core
node_modules/@aws-amplify/datastore
@aws-amplify/pubsub >=3.0.21-unstable.9
Depends on vulnerable versions of @aws-amplify/core
node_modules/@aws-amplify/pubsub
@aws-amplify/xr >=2.1.20-unstable.9
Depends on vulnerable versions of @aws-amplify/core
node_modules/@aws-amplify/xr
@aws-sdk/credential-provider-cognito-identity >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/client-cognito-identity
node_modules/@aws-sdk/credential-provider-cognito-identity
@aws-sdk/client-comprehend >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-comprehend
@aws-amplify/predictions >=3.1.20-unstable.9
Depends on vulnerable versions of @aws-sdk/client-comprehend
node_modules/@aws-amplify/predictions
@aws-sdk/client-lex-runtime-service >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-lex-runtime-service
@aws-amplify/interactions >=3.1.20-unstable.9
Depends on vulnerable versions of @aws-sdk/client-lex-runtime-service
node_modules/@aws-amplify/interactions
@aws-sdk/client-polly >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-polly
@aws-sdk/client-rekognition >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-rekognition
@aws-sdk/client-s3 >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-s3
@aws-amplify/storage >=3.2.10-unstable.9
Depends on vulnerable versions of @aws-sdk/client-s3
node_modules/@aws-amplify/storage
@aws-sdk/client-textract >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-textract
@aws-sdk/client-translate >=1.0.0-gamma.3
Depends on vulnerable versions of @aws-sdk/middleware-retry
node_modules/@aws-sdk/client-translate
metro-config <=0.63.0
Depends on vulnerable versions of metro
node_modules/metro-config

    30 low severity vulnerabilities

Some of these can be false positives but we’ll need to wait for the library authors to fix this.

You can also add AWS Amplify Forms to your site with a form backend service fabform. Its very handy.