sst / guide

Repo for guide.sst.dev
https://guide.sst.dev
MIT License
3.68k stars 446 forks source link

Comments: Configure AWS Amplify #208

Closed jayair closed 6 years ago

jayair commented 6 years ago

Link to chapter - https://serverless-stack.com/chapters/configure-aws-amplify.html

davidmsvetlecic commented 6 years ago

fyi (in case anyone else had this problem): I was not able to upload a file to S3 due to permission error. Even though there was no difference in the policy, creating a new Cognito Identity Pool and it worked for me.

viccooper142 commented 6 years ago

Small typo: "The name: "notes" is basically telling Amplify that we want to name our API. Amplify allows you to add multiple APIs that you your app is going to work with. In our case our entire backend is just one single API."

jayair commented 6 years ago

@viccooper142 Thanks. Fixed.

ramnavan commented 6 years ago

My question is behind the relationship between user pool and identity pool when performing signup and signin. Since signup and signin are primarily handled only my the Cognito User Pool, it confuses me why IdentityPoolId needs to be specified when configuring AWS Amplify? SignUp operation especially just creates user in the User Pool. What's identity pool's involvement here?

jayair commented 6 years ago

@ramnavan I'm not sure if you had a chance to look at this chapter - https://serverless-stack.com/chapters/cognito-user-pool-vs-identity-pool.html

But the Identity Pool uses the User Pool as an authentication provider and then secures access to the other AWS resources.

kerly commented 6 years ago

Does anyone have any recommendations for configuring multiple environments (dev and prod) with Amplify.configure? I've looked into the node package "configure", but that seems to be geared towards running a node server not a static website.

Answering my own question here: I found that create-react-app has this covered with environment variables. User guide here: create-react-app

jayair commented 6 years ago

@kerly We cover the general idea based on the Create React App docs here - https://serverless-stack.com/chapters/environments-in-create-react-app.html

jayair commented 6 years ago

This issue was moved to https://discourse.serverless-stack.com/t/comments-configure-aws-amplify/151

vivekmittal24 commented 6 years ago

Getting Following exception whenever I am adding the below line import Amplify from "aws-amplify";

Error: Cannot use undefined "Boolean" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
vivekmittal24 commented 6 years ago

Resolved : works on every browser except Internet Explorer where the following error occurs. Refrence Link : https://stackoverflow.com/questions/50421838/ie-graphql-script5022-cannot-use-undefined-boolean-from-another-module-or

jayair commented 6 years ago

@vivekmittal24 So the issue happens when you load the page in IE?

TheAshwanik commented 4 years ago

Hi.. I am following your tutorial, Many thanks for it. I am Getting Following exception whenever I am adding the below line import Amplify from "aws-amplify";

Failed to compile.

Error in ./~/@aws-sdk/credential-provider-cognito-identity/dist/cjs/fromCognitoIdentity.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/credential-provider-cognito-identity/dist/cjs/fromCognitoIdentity.js Unexpected token (13:20)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (13:20)
 @ ./~/@aws-sdk/credential-provider-cognito-identity/dist/cjs/index.js 4:21-53

Error in ./~/@aws-sdk/credential-provider-cognito-identity/dist/cjs/fromCognitoIdentityPool.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/credential-provider-cognito-identity/dist/cjs/fromCognitoIdentityPool.js Unexpected token (22:28)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (22:28)
 @ ./~/@aws-sdk/credential-provider-cognito-identity/dist/cjs/index.js 5:21-57

Error in ./~/@aws-sdk/client-cognito-identity/dist/cjs/protocols/Aws_json1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-cognito-identity/dist/cjs/protocols/Aws_json1_1.js Unexpected token (4:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (4:6)
 @ ./~/@aws-sdk/client-cognito-identity/dist/cjs/commands/CreateIdentityPoolCommand.js 3:22-57

Error in ./~/@aws-sdk/client-lex-runtime-service/dist/cjs/protocols/Aws_restJson1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-lex-runtime-service/dist/cjs/protocols/Aws_restJson1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-lex-runtime-service/dist/cjs/commands/DeleteSessionCommand.js 3:26-65

Error in ./~/@aws-sdk/client-pinpoint/dist/cjs/protocols/Aws_restJson1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-pinpoint/dist/cjs/protocols/Aws_restJson1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-pinpoint/dist/cjs/commands/CreateAppCommand.js 3:26-65

Error in ./~/@aws-sdk/client-kinesis/dist/cjs/protocols/Aws_json1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-kinesis/dist/cjs/protocols/Aws_json1_1.js Unexpected token (4:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (4:6)
 @ ./~/@aws-sdk/client-kinesis/dist/cjs/commands/AddTagsToStreamCommand.js 3:22-57

Error in ./~/@aws-sdk/client-firehose/dist/cjs/protocols/Aws_json1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-firehose/dist/cjs/protocols/Aws_json1_1.js Unexpected token (4:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (4:6)
 @ ./~/@aws-sdk/client-firehose/dist/cjs/commands/CreateDeliveryStreamCommand.js 3:22-57

Error in ./~/@aws-sdk/client-personalize-events/dist/cjs/protocols/Aws_restJson1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-personalize-events/dist/cjs/protocols/Aws_restJson1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-personalize-events/dist/cjs/commands/PutEventsCommand.js 3:26-65

Error in ./~/@aws-sdk/client-s3/dist/cjs/protocols/Aws_restXml.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-s3/dist/cjs/protocols/Aws_restXml.js Unexpected token (7:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (7:6)
 @ ./~/@aws-sdk/client-s3/dist/cjs/commands/AbortMultipartUploadCommand.js 3:22-57

Error in ./~/@aws-sdk/signature-v4/dist/cjs/SignatureV4.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/signature-v4/dist/cjs/SignatureV4.js Unexpected token (36:10)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (36:10)
 @ ./~/@aws-sdk/signature-v4/dist/cjs/index.js 5:21-45

Error in ./~/@aws-sdk/client-translate/dist/cjs/protocols/Aws_json1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-translate/dist/cjs/protocols/Aws_json1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-translate/dist/cjs/commands/DeleteTerminologyCommand.js 3:22-57

Error in ./~/@aws-sdk/client-polly/dist/cjs/protocols/Aws_restJson1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-polly/dist/cjs/protocols/Aws_restJson1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-polly/dist/cjs/commands/DeleteLexiconCommand.js 3:26-65

Error in ./~/@aws-sdk/client-rekognition/dist/cjs/protocols/Aws_json1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-rekognition/dist/cjs/protocols/Aws_json1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-rekognition/dist/cjs/commands/CompareFacesCommand.js 3:22-57

Error in ./~/@aws-sdk/client-textract/dist/cjs/protocols/Aws_json1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-textract/dist/cjs/protocols/Aws_json1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-textract/dist/cjs/commands/AnalyzeDocumentCommand.js 3:22-57

Error in ./~/@aws-sdk/client-comprehend/dist/cjs/protocols/Aws_json1_1.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/client-comprehend/dist/cjs/protocols/Aws_json1_1.js Unexpected token (5:6)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (5:6)
 @ ./~/@aws-sdk/client-comprehend/dist/cjs/commands/BatchDetectDominantLanguageCommand.js 3:22-57

Error in ./~/@aws-sdk/credential-provider-process/build/index.js
Module not found: 'child_process' in /home/ubuntu/myapp-client/node_modules/@aws-sdk/credential-provider-process/build

 @ ./~/@aws-sdk/credential-provider-process/build/index.js 5:22-46

Error in ./~/@aws-sdk/node-http-handler/build/node-http2-handler.js
Module not found: 'http2' in /home/ubuntu/myapp-client/node_modules/@aws-sdk/node-http-handler/build

 @ ./~/@aws-sdk/node-http-handler/build/node-http2-handler.js 3:16-32

Error in ./~/@aws-sdk/eventstream-serde-node/build/EventStreamMarshaller.js
Module parse failed: /home/ubuntu/myapp-client/node_modules/@aws-sdk/eventstream-serde-node/build/EventStreamMarshaller.js Unexpected token (39:18)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (39:18)
 @ ./~/@aws-sdk/eventstream-serde-node/build/provider.js 3:32-66
jayair commented 4 years ago

Please post this over on the forums — https://discourse.serverless-stack.com