By using AWS re:Post, you agree to the Terms of Use
/AWS Amplify/

Questions tagged with AWS Amplify

Sort by most recent
  • 1
  • 90 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

NextJS app fails during Amplify CI/CD deployment

I have a NextJS app that uses SSR. Therefore manual deployment is not an option. I have setup Amplify hosting for the app. Deployment (initiated by GitHub push) fails due: ``` Must use import to load ES Module: /codebuild/output/.../src/aws-exports.js require() of ES modules is not supported. require() of /codebuild/output/src531993483/src/myidtoken/src/aws-exports.js from /snapshot/repo/build/node_modules/amplify-frontend-javascript/lib/frontend-config-creator.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename aws-exports.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /codebuild/output/src531993483/src/myidtoken/package.json. 2022-05-10T13:24:35.567Z [INFO]: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /codebuild/output/src531993483/src/myidtoken/src/aws-exports.js require() of ES modules is not supported. require() of /codebuild/output/src531993483/src/myidtoken/src/aws-exports.js from /snapshot/repo/build/node_modules/amplify-frontend-javascript/lib/frontend-config-creator.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename aws-exports.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /codebuild/output/src531993483/src/myidtoken/package.json. ``` I do not have aws-exports.js committed to GitHub. So aws-exports.js is generated during the build/deploy. Therefore I cannot rename it to `.csj`. I have tried though creating `my-aws-exports.js` and include that from my code. However, the error is still the same. This also sounds to me that the error is in generated code. Repository is not unfortunately public so I cannot share it. I'm using - react 17 - next 12 - aws-amplify 4.3.21 - aws-sdk 2.1131.0 `package.json` states ` "type": "module",`.
1
answers
0
votes
0
views
niobium
asked 6 days ago

I'd like to request to S3 as a cognito certification qualification.

I'd like to request to S3 as a cognito certification qualification. S3 is using sdk Cognito is using amplify. Use an angular typescript. I would like to replace the secret key with the cognito authentication information when creating S3. I want to access s3 with the user I received from Auth.signIn, but the credentials are missing. I need your help. ``` public signIn(user: IUser): Promise<any> { return Auth.signIn(user.email, user.password).then((user) => { AWS.config.region = 'ap-northeast-2'; AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'ap-northeast-2:aaaaaaaa-bbbb-dddd-eeee-ffffffff', }); const userSession = Auth.userSession(user); const idToken = userSession['__zone_symbol__value']['idToken']['jwtToken']; AWS.config.region = 'ap-northeast-2'; AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'ap-northeast-2:aaaaaaaa-bbbb-dddd-eeee-ffffffff', RoleArn: 'arn:aws:iam::111111111111:role/Cognito_role', Logins: { CognitoIdentityPool: 'ap-northeast-2:aaaaaaaa-bbbb-dddd-eeee-ffffffff', idToken: idToken, }, })); const s3 = new AWS.S3({ apiVersion: '2012-10-17', region: 'ap-northeast-2', params: { Bucket: 'Bucketname', }, }); s3.config.credentials.sessionToken = user.signInUserSession['accessToken']['jwtToken']; s3.listObjects(function (err, data) { if (err) { return alert( 'There was an error: ' + err.message ); } else { console.log('***********s3List***********', data); } }); } ``` bucket policy ``` { "Version": "2012-10-17", "Id": "Policy", "Statement": [ { "Sid": "AllowIPmix", "Effect": "Allow", "Principal": "*", "Action": "*", "Resource": "arn:aws:s3:::s3name/*", } ] } ``` cognito Role Policies - AmazonS3FullAccess ``` { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*", ], "Resource": "*" } ] } ```
0
answers
0
votes
5
views
I need help
asked 11 days ago

Storing/representing a hierarchical tree used for navigation within an Amplify web app and AppSync GraphQL API layer.

Hi, **TL;DR: Can anyone give a recommend approach to storing customisable n-level hierarchy trees for grouping and navigating results via a frontend Amplify-powered web app (using DynamoDB or any other database solution that can be mapped to AppSync ideally)?** **Some background** I'm building an multi-tenant IoT analytics solution that takes data from some sensors out in the field, uploads to AWS, processes this data and stores in a DynamoDB table (i.e. a very "standard" setup). I'm planning on adding a web frontend (built using Amplify and an AppSync GraphQL layer) that will allow users to navigate a **customisable, n-level** hierarchy tree of assets, in order to view the sensor data we've collected. Examples of valid hierarchies include: Country -> Site -> Building -> Floor -> Room -> Sensor (6-level) or Site -> Building -> Room -> Sensor (4-level) etc. The important thing here, is that this hierarchy tree can differ per customer, and needs to be customisable on a tenant-by-tenant basis, but we don't need to do any complex analysis or navigation of relationships between hierarchy levels (so, to me, something like Amazon Neptune or another graph database feels a bit overkill, but perhaps I’m wrong). My first thought was to try and build a hierarchical relationship inside of a DynamoDB table, possibly making use of a GSI to provide this, but in all of the examples I’ve seen online, the focus is very much on quick retrieval, but not so quick updating of hierarchy trees – now, whilst it’s unlikely that these tree structures would be updated on a regular basis, it is something we need to be able to support, so the idea of possibly updating ‘000s of rows in DynamoDB every time we want to make a change to the hierarchy tree for a given control area doesn’t seem quite right to me. Hence, my question above. I'm ideally looking for guidance on how to structure a DDB table to best support BOTH optimal retrieval of, and updates to, hierarchy trees in our application, but if DDB isn't the right answer here, then suggestions of alternatives would also be greatly appreciated. Many thanks in advance.
1
answers
0
votes
3
views
cgddrd
asked 14 days ago

/api/auth/login Lambda@Edge failing with "secret" is required on AWS Amplify

I am deploying next.js application with auth0 authentication onto AWS Amplify. This is working on localhost as expected. I created "Environment variables" with AUTH0_SECRET and others in the amplify App Settings, and I am able to authenticate and it is working fine. Suddenly after one of the deployment, I keep getting this error. I redeployed older version, error did not disappear. I believe it is not the app issue, it is something to do with Amplify settings as previous deployment also stopped working. Browser Error ``` 503 ERROR The request could not be satisfied. The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner. If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation. ``` Logs: ``` ERROR Invoke Error { "errorType": "TypeError", "errorMessage": "\"secret\" is required", "stack": [ "TypeError: \"secret\" is required", " at Object.get (/var/task/node_modules/@auth0/nextjs-auth0/dist/auth0-session/get-config.js:147:15)", " at Object.getConfig (/var/task/node_modules/@auth0/nextjs-auth0/dist/config.js:66:38)", " at Object.initAuth0 (/var/task/node_modules/@auth0/nextjs-auth0/dist/index.js:22:23)", " at getInstance (/var/task/node_modules/@auth0/nextjs-auth0/dist/index.js:18:24)", " at handleAuth (/var/task/node_modules/@auth0/nextjs-auth0/dist/index.js:124:18)", " at Object.5862 (/var/task/pages/api/auth/[...auth0].js:214:129)", " at __webpack_require__ (/var/task/webpack-api-runtime.js:25:42)", " at Object.7416 (/var/task/pages/api/auth/[...auth0].js:189:23)", " at __webpack_require__ (/var/task/webpack-api-runtime.js:25:42)", " at __webpack_exec__ (/var/task/pages/api/auth/[...auth0].js:325:39)" ] } ``` for debugging, I printed the secret using console.log and I am able to see it. Reproduction my [...auth0].js ``` import { handleAuth } from '@auth0/nextjs-auth0'; console.log('the AUTH0_SECRET env var is set: ', !!process.env.AUTH0_SECRET); export default handleAuth(); ``` Environment Please provide the following: Version of this library used: "@auth0/auth0-react": "^1.9.0", "@auth0/nextjs-auth0": "^1.7.0", "axios": "^0.26.1", "jsonwebtoken": "^8.5.1", "next": "latest", "react": "17.0.2", "react-dom": "17.0.2", "react-is": "^18.0.0", "swr": "^1.3.0",
0
answers
0
votes
2
views
AWS-User-8380747
asked 16 days ago

How to pass the Amplify app ID to a function? How to do app introspection from backend functions?

## Background Amplify apps are easily extensible with Lambda functions, using `amplify add function`. Great! ## Problem How can I access the Amplify app ID from the Lambda function code? There are a lot of scenarios where I need that string in order to locate resources or access secrets in SSM. ## More generally How can my function do introspection on the app? How can I get the app ID from the Lambda function? Is there a service? Am I supposed to pass the information (somehow) through the CloudFormation template for the function? ## Due diligence I've spent days trying to figure this out, and I have at least learned the secret, undocumented way to get anything in a nested CloudFormation stack's outputs into the parameters for my CloudFormation stack, so that I can create environment variables that my Lambda function can see. That does not solve my original problem of finding the top-level app ID. Or any information about the top-level app. If I could find the stack name for the top-level CloudFormation for the stack then I could learn a lot of things. I can't. #### How to pass stack outputs from app resources into function stack parameters I've spent days trying to figure this out, and I have at least learned the secret, undocumented way to use `dependsOn` in the backend-config.json to get the outputs from the CloudFormation stacks for other resources in the Amplify app and feed those into the parameters for my stack for my function: ``` "function": { "MyFunctionName": { "build": true, "providerPlugin": "awscloudformation", "service": "Lambda", "dependsOn": [ { "category": "api", "resourceName": "Data", "attributes": [ "GraphQLAPIIdOutput" ] } ], } } } ``` That creates a new parameter for your function that's named using a pattern that's not documented anywhere, from what I can tell: `[category][resource name][CloudFormation stack output name]`. You can reference that in your CloudFormation stack for your function to create an environment variable that your function code can access: ``` { "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { ... "secretsPathAmplifyAppId": { "Type": "String" } ... "Resources": { ... "Environment": { "Variables": { "AMPLIFY_APP_ID": { "Ref": "secretsPathAmplifyAppId" }, ``` #### Using the `AmplifyAppId` in `amplify-meta.json` doesn't work If I could access the `provider` / `cloudformation` data from a `dependsOn` then I could get the app ID into my function's stack. But that doesn't work. I spent some time eliminating that possibility. #### Using `secretsPathAmplifyAppId` There is a side effect of using amplify update function to add secrets. If you add any secret to the function then you will get a new parameter as an input to your function's CloudFormation stack: `secretsPathAmplifyAppId` I did that and added a dummy secret that I don't really need, in order to get that CloudFormation stack parameter containing the Amplify App ID that I do need. And then I referenced that in my CloudFormation template for my function: ``` { "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { ... "env": { "Type": "String" }, "s3Key": { "Type": "String" }, ... "secretsPathAmplifyAppId": { "Type": "String" } ``` That works, right? **No!** If I create a new app in Amplify, perhaps deploying it to a staging or production account for the first time, then I'll get the error `Parameters: [secretsPathAmplifyAppId] must have values` from the initial build when I press "Save and Deploy" on the "Host your web app" form. This is because using `secretsPathAmplifyAppId` relies on the Amplify CLI adding the value to the `team-provider-info.json` file. For a new app's first deployment, "the `team-provider-info.json` file is not available in the Admin UI deployment job", as described in https://github.com/aws-amplify/amplify-cli/issues/8513 . And there is apparently no solution. ## WHY IS THIS SO HARD?!? The Amplify documentation implies that it's not difficult to add a Lambda function and do whatever. I'm a Lambda pro and a code pro, and I can do whatever. But only if I can pass context information to my code. How can an Amplify app's Lambda functions do introspection on the app?
1
answers
0
votes
2
views
TaoRyan
asked 18 days ago

Possible to override default GraphQL @model resolvers with Lambda function resolvers?

I'm hoping to leverage a GraphQL model managed by Amplify / AppSync and build on that, using the DynamoDB table for storage but then adding my own custom business logic. In the current example, I want a model that represents a session for an external API, and I want to override the `create` mutation with a Lambda function that will call the external API to get an access token, and then add that token to the newly-created `@model` instance. I'm trying to do that by disabling the default `create` resolver and then adding my own in my GraphQL schema: ``` type ExternalAPISession @model(mutations: { create: null }) @auth(rules: [{allow: public}]) { id: ID! username: String! @index(name: "byUsername", queryField: "getExternalAPISessionByUsername") access_token: String! refresh_token: String! } type Mutation { createExternalAPISession(username: String, password: String): ExternalAPISession @function(name: "CreateExternalAPISession-${env}") } ``` But, even though I tried to disable the default `create` resolver, I still get this error when I try to `amplify push` this schema: ``` ⠹ Updating resources in the cloud. This may take a few minutes... Following resources failed Resource Name: MutationcreatePaytronixSessionResolver (AWS::AppSync::Resolver) Event Type: create Reason: Only one resolver is allowed per field. (Service: AWSAppSync; Status Code: 400; Error Code: BadRequestException; Request ID: 08399b17-1e38-46f6-bf9f-06f68356c21a; Proxy: null) ``` Is it even possible to do what I'm trying to do? I can't seem to find any explicit confirmation in the documentation that you can override a default CRUD action with your own Lambda function resolver. I see that you can override the default CRUD VTL templates with your own VTL. But can you override them with Lambda functions?
2
answers
0
votes
4
views
TaoRyan
asked 25 days ago

enhanced subscription filtering connection error when using amplify-cli generated mutations

I am using amplify-cli with angular front-end. I have the following schema (schema.graphql): ``` type CardDeck @model @key(name: "byBoard", fields: ["boardId"], queryField: "cardDeckByBoardId") { id: ID! type: String! properties: [PropertyOrderTwo] boardId: ID! } type Subscription { onUpdateCardDeckByBoardId(boardId: ID!): CardDeck @aws_subscribe(mutations: "updateCardDeck") } ``` I added the following response mapping template to the subscription in the appSync console. ``` ## Response Mapping Template - onUpdateCardDeckByBoardId subscription $extensions.setSubscriptionFilter({ "filterGroup": [ { "filters" : [ { "fieldName" : "boardId", "operator" : "eq", "value" : "**** -> a valid board id" } ] } ] }) $util.toJson($context.result) ``` This results in the following connection error when subscribing to the listener in my app: ``` Connection failed: {"errors":[{"message":"Cannot return null for non-nullable type: 'ID' within parent 'CardDeck' (/onUpdateCardDeckByBoardId/id)"},{"message":"Cannot return null for non-nullable type: 'String' within parent 'CardDeck' (/onUpdateCardDeckByBoardId/type)"},{"message":"Cannot return null for non-nullable type: 'ID' within parent 'CardDeck' (/onUpdateCardDeckByBoardId/boardId)"},{"message":"Cannot return null for non-nullable type: 'AWSDateTime' within parent 'CardDeck' (/onUpdateCardDeckByBoardId/createdAt)"},{"message":"Cannot return null for non-nullable type: 'AWSDateTime' within parent 'CardDeck' (/onUpdateCardDeckByBoardId/updatedAt)"}]} ``` What am I doing wrong?
1
answers
0
votes
2
views
PatrickSteyaert
asked a month ago

How do I set up an AWS Amplify project to query an existing AWS AppSync API?

Hi, I am new to AWS Amplify and would like guidance on how to send a query to an ***existing*** GraphQL API on AWS AppSync. I am unsure how to start as a lot of Amplify coverage creates a *new* AppSync API using the Amplify CLI. ## Objectives * Set up a Node.js project to work with an existing AWS AppSync API, using AWS Amplify as the GraphQL client. * Send a single query to an existing AWS AppSync API. The query lists game results from a DynamoDB table and is called `listGames` in my GraphQL schema. * I need to repeat the query in order to fetch all available database records that satisfy the query. This would mean adding results to an array/object until the `nextToken` is `null` (i.e. no more records can be found for the query). ## Context * This application is deployed in an Amazon ECS container using AWS Fargate. * The ECS service is fronted by an Application Load Balancer (ALB). * A leader board web page fetches game results through a `POST` request to the ALB's DNS name / URL and adds them to a HTML table. ## Notes * For now, API key is my authentication method. I would soon like to switch to a task IAM role in ECS. * The ECS deployment described in 'Context' is working but it sends `POST` requests without AWS libraries. It is my understanding that I would need to use an AWS library in order to use an IAM role for AppSync authentication (used as a [task IAM role in ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html)). Please correct me if I am mistaken. I would greatly appreciate any help you can give me. Thank you for your time!
1
answers
1
votes
4
views
Toby
asked a month ago

Amplify export infrastructures does not work with CDK V2

According to [Amplify documentation](https://docs.amplify.aws/cli/usage/export-to-cdk/) and [this official blog post](https://aws.amazon.com/blogs/mobile/export-amplify-backends-to-cdk-and-use-with-existing-deployment-pipelines/), it is possible to export infrastructures from Amplify then import into CDK. However, I try with CDK V2 and it does not work. I got error when installing **npm i @aws-amplify/cdk-exported-backend@latest**. CDK V2 **Construct** is not compatible with the **Construct** in aws-amplify/cdk-exported-backend, I think. So how to export Amplify infrastructure to CDK V2? Thank you! 1. Here is my package.json of CDK ``` { "name": "amplify-export-cdk", "version": "0.1.0", "bin": { "amplify-export-cdk": "bin/amplify-export-cdk.js" }, "scripts": { "build": "tsc", "watch": "tsc -w", "test": "jest", "cdk": "cdk" }, "devDependencies": { "@types/jest": "^26.0.10", "@types/node": "10.17.27", "jest": "^26.4.2", "ts-jest": "^26.2.0", "aws-cdk": "2.18.0", "ts-node": "^9.0.0", "typescript": "~3.9.7" }, "dependencies": { "aws-cdk-lib": "2.18.0", "constructs": "^10.0.0", "source-map-support": "^0.5.16" } } ``` 2. Here is errors when installing ``` npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: amplify-export-cdk@0.1.0 npm ERR! Found: constructs@10.0.108 npm ERR! node_modules/constructs npm ERR! constructs@"^10.0.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer constructs@"^3.2.27" from @aws-amplify/cdk-exported-backend@0.0.5 npm ERR! node_modules/@aws-amplify/cdk-exported-backend npm ERR! @aws-amplify/cdk-exported-backend@"0.0.5" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. ```
0
answers
1
votes
3
views
hai
asked a month ago

AmplifyProvider generate a huge amount of warnings on import

I am getting a huge amount of warnings when I import AmplifyProvider. ``` WARNING in ./node_modules/@aws-amplify/ui/dist/esm/types/authenticator/user.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from 'D:\reactjs\amplify-work\node_modules\@aws-amplify\src\types\authenticator\user.ts' file: Error: ENOENT: no such file or directory, open 'D:\reactjs\amplify-work\node_modules\@aws-amplify\src\types\authenticator\user.ts' @ ./node_modules/@aws-amplify/ui/dist/esm/index.js 14:0-95 14:0-95 14:0-95 @ ./node_modules/@aws-amplify/ui-react/dist/esm/index.js 8:0-74 8:0-74 8:0-74 8:0-74 @ ./src/index.js 10:0-56 WARNING in ./node_modules/@aws-amplify/ui/dist/esm/validators/index.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from 'D:\reactjs\amplify-work\node_modules\@aws-amplify\src\validators\index.ts' file: Error: ENOENT: no such file or directory, open 'D:\reactjs\amplify-work\node_modules\@aws-amplify\src\validators\index.ts' @ ./node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/actors/signIn.js 8:0-66 528:23-24 @ ./node_modules/@aws-amplify/ui/dist/esm/machines/authenticator/index.js 4:0-54 275:18-19 @ ./node_modules/@aws-amplify/ui/dist/esm/index.js 12:0-79 12:0-79 @ ./node_modules/@aws-amplify/ui-react/dist/esm/index.js 8:0-74 8:0-74 8:0-74 8:0-74 @ ./src/index.js 10:0-56 WARNING in src\index.js Line 5:8: 'Amplify' is defined but never used no-unused-vars Line 7:10: 'AmplifyProvider' is defined but never used no-unused-vars 1548 warnings have detailed information that is not shown. Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it. webpack 5.71.0 compiled with 1549 warnings in 513 ms ``` =============================================== Create standard: create-react-app Import: npm i @aws-amplify/ui-react aws-amplify File index.js ``` import React from "react"; import ReactDOM from "react-dom"; import "./index.css"; import App from "./App"; import Amplify from "aws-amplify"; import "@aws-amplify/ui-react/styles.css"; import { AmplifyProvider } from "@aws-amplify/ui-react"; ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById("root") ); ``` File App.js ``` import "./App.css"; function App() { return ( <div className="App"> <header className="App-header"> <h1>Hello world</h1> </header> </div> ); } export default App; ``` package.json ``` { "name": "amplify-work", "version": "0.1.0", "private": true, "dependencies": { "@aws-amplify/ui-react": "^2.13.0", "@testing-library/jest-dom": "^5.16.3", "@testing-library/react": "^12.1.4", "@testing-library/user-event": "^13.5.0", "aws-amplify": "^4.3.18", "react": "^18.0.0", "react-dom": "^18.0.0", "react-scripts": "5.0.0", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } } ```
1
answers
0
votes
2
views
AWS-User-2035787
asked a month ago
1
answers
0
votes
4
views
devtwo
asked 2 months ago

Cloud 9 IDE Vue.js unable to preview browser on 8080

Environment: Using t3.small with resized EBS to 20GB; Connecting from: Mac OS (Safari or Chrome - current versions) Repro: ``` nvm install stable npm install -g @aws-amplify/cli # optional (unless testing `amplify run`) npm install vue npm install -g @vue/cli vue create testsite # use babel, router, lint; vue3 cd testsite npm run serve ``` At this point server is running normally with following message: App running at: - Local: http://localhost:8080/ - Network: http://xxx.xxx.xxx.xxx:8080/ However Cloud9 reports following error: Cloud9 Help You may be using the wrong PORT & IP for your server application. Try passing port 8080 to properly launch your application. We can continue installing Amplify to show it also fails with amplify run: ``` amplify configure # create or use existing amplify user passing appropriate key/secret ids amplify init # use defaults npm install aws-amplify @aws-amplify/ui-components amplify add auth # optional - I was trying to test drive Cognito; some code changes required, but not relevant for this test amplify push amplify run ``` Same result as with npm run serve. Reviewed following references, but did not find any working solutions: * https://docs.aws.amazon.com/cloud9/latest/user-guide/app-preview.html#app-preview-run-app * https://docs.aws.amazon.com/cloud9/latest/user-guide/troubleshooting.html#troubleshooting-app-preview * https://repost.aws/questions/QUyfyfFI92TO6lN6s6Ti-7Ig/can-no-longer-preview-running-applications-vfs-connection-does-not-exist * Note: In Chrome this seems to now be "SameParty cookies to be first-party" and in Safari disabling prevent cross-site tracking and block all cookies - neither worked for me When I had first started while following the initial Cloud 9 guide I was able to get the preview application to work while using the default t3.micro instance on Safari. After upgrading to t3.small it did not work any longer, though the t3.micro instance was failing in numerous other ways due to low memory, so this was not a viable setup. Following through the Cloud 9 instructions to create new environment instances I was unable to get any working Preview scenarios in any of the environments following various variations on the setup and sequencing of the vue3 and vue/cli installation. Any additional suggestions are appreciated.
0
answers
0
votes
4
views
AWS-User-3064583
asked 2 months ago

Amplify build failed because the bucket already exists

Hi, I am trying to deploy an amplify app as per https://webapp.serverlessworkshops.io/staticwebhosting/deploy/ but the build is failing because of an existing bucket I am unable to see the bucket in S3. How can I delete the bucket? or how to resolve this issue? ``` 2022-02-25T03:31:32.457Z [INFO]: An error occurred when creating the CloudFormation stack 2022-02-25T03:31:32.459Z [WARNING]: ✖ Root stack creation failed 2022-02-25T03:31:32.464Z [INFO]: AlreadyExistsException: Stack [amplify-wildrydes-prod-32220] already exists at Request.extractError (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/protocol/query.js:50:29) at Request.callListeners (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:106:20) at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:686:14) at Request.transition (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12) at /root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:12) at Request.callListeners (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18) at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:686:14) at Request.transition (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:14:12) at /root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/request.js:688:12) at Request.callListeners (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:116:18) at callNextListener (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/sequential_executor.js:96:12) at IncomingMessage.onEnd (/root/.nvm/versions/node/v14.18.1/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/event_listeners.js:335:13) at IncomingMessage.emit (events.js:412:35) at IncomingMessage.emit (domain.js:475:12) at endReadableNT (internal/streams/readable.js:1334:12) at processTicksAndRejections (internal/process/task_queues.js:82:21) { code: 'AlreadyExistsException', time: 2022-02-25T03:31:32.456Z, requestId: '92bb3d71-1610-43c4-a385-54cb25e459cd', statusCode: 400, retryable: false, retryDelay: 81.16703459454344 } 2022-02-25T03:31:32.487Z [ERROR]: !!! Build failed 2022-02-25T03:31:32.487Z [ERROR]: !!! Non-Zero Exit Code detected 2022-02-25T03:31:32.488Z [INFO]: # Starting environment caching... 2022-02-25T03:31:32.488Z [INFO]: # Environment caching completed Terminating logging... ``` Thank you
0
answers
0
votes
6
views
Sri
asked 3 months ago

Amplify Storage.put succeeds on iOS, throws axios 403 forbidden error on android (React Native)

We have a react-native app that allows users to import images from a network camera and upload them to an S3 bucket. We recently migrated from Expo Kit (SDK37) to Expo Bare (SDK43), RN Version 0.64.2 On iOS, both the release build and local debug builds work as expected and images are successfully uploaded to our S3 bucket. However, on Android, we get an error saying that the signature doesn't match, and a 403 error from axios. Here's what my setup looks like: ``` System: OS: macOS 12.2 CPU: (8) arm64 Apple M1 Memory: 85.48 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.1 - /usr/local/bin/node Yarn: 1.22.17 - /opt/homebrew/bin/yarn npm: 8.1.4 - /opt/homebrew/bin/npm Watchman: 2021.11.29.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 98.0.4758.102 Firefox: 97.0.1 Safari: 15.3 npmPackages: @BeeCorp/react-native-volume-control: 1.0.1 @apollo/client: ^3.4.16 => 3.5.9 @babel/core: ^7.12.9 => 7.17.5 @babel/plugin-proposal-class-properties: ^7.14.5 => 7.16.7 @fortawesome/fontawesome-svg-core: ^1.2.36 => 1.3.0 @fortawesome/free-solid-svg-icons: ^5.15.4 => 5.15.4 @fortawesome/react-native-fontawesome: ^0.2.7 => 0.2.7 @react-native-async-storage/async-storage: ~1.15.0 => 1.15.17 @react-native-community/datetimepicker: 3.5.2 => 3.5.2 @react-native-community/masked-view: ^0.1.11 => 0.1.11 @react-native-community/netinfo: ^8.0.0 => 8.0.0 @react-native-community/slider: 4.1.12 => 4.1.12 @react-native-firebase/app: ^14.1.0 => 14.5.0 @react-native-firebase/crashlytics: ^14.1.0 => 14.5.0 @react-native-picker/picker: ^2.2.1 => 2.2.1 @unimodules/core: ~7.2.0 => 7.2.0 amazon-cognito-identity-js: ^5.2.6 => 5.2.6 aws-amplify: ^4.3.14 => 4.3.14 aws-amplify-react-native: ^6.0.2 => 6.0.2 aws-appsync: ^4.1.4 => 4.1.4 aws-sdk: ^2.1013.0 => 2.1077.0 axios: ^0.23.0 => 0.23.0 babel-preset-react-native: ^4.0.1 => 4.0.1 buffer: ^6.0.3 => 6.0.3 expo: ^43.0.0 => 43.0.5 expo-asset: ~8.4.3 => 8.4.6 expo-av: ~10.1.3 => 10.1.3 expo-background-fetch: ~10.0.3 => 10.0.3 expo-barcode-scanner: ~11.1.2 => 11.1.2 expo-constants: ~12.1.3 => 12.1.3 expo-location: ~13.0.4 => 13.0.4 expo-secure-store: ~11.0.3 => 11.0.3 expo-sensors: ~11.0.3 => 11.0.3 expo-splash-screen: ~0.13.5 => 0.13.5 expo-status-bar: ~1.1.0 => 1.1.0 expo-task-manager: ~10.0.3 => 10.0.3 expo-updates: ~0.10.5 => 0.10.15 graphql-tag: ^2.12.5 => 2.12.6 jest-fetch-mock: ^3.0.3 => 3.0.3 jest-mock-axios: ^4.4.1 => 4.5.0 jetifier: ^2.0.0 => 2.0.0 jsdom: ^18.0.0 => 18.1.1 lodash: ^4.17.21 => 4.17.21 moment: ^2.29.1 => 2.29.1 react: 17.0.1 => 17.0.1 react-apollo: ^3.1.5 => 3.1.5 react-dom: 17.0.1 => 17.0.1 react-native: ^0.64.2 => 0.64.3 react-native-animatable: ^1.3.3 => 1.3.3 react-native-background-timer: ^2.4.1 => 2.4.1 react-native-battery: ^0.1.18 => 0.1.18 react-native-collapsible: ^1.6.0 => 1.6.0 react-native-config: ^1.4.5 => 1.4.5 react-native-copilot: ^2.5.1 => 2.5.1 react-native-doc-viewer: https://github.com/mikemeyer30/react-native-doc-viewer => 2.7.8 react-native-flash-message: ^0.2.0 => 0.2.1 react-native-geolocation-service: ^5.3.0-beta.3 => 5.3.0-beta.4 react-native-gesture-handler: ~1.10.2 => 1.10.3 react-native-get-random-values: ^1.7.0 => 1.7.2 react-native-image-picker: ^4.1.2 => 4.7.3 react-native-keyboard-aware-scroll-view: ^0.9.4 => 0.9.5 react-native-keyboard-spacer: git+https://github.com/datso/react-native-keyboard-spacer.git => 0.4.1 react-native-material-design: ^0.3.7 => 0.3.7 react-native-material-dropdown-v2: ^0.11.1 => 0.11.1 react-native-paper: ^4.10.0 => 4.11.2 react-native-queue: https://github.com/mikemeyer30/react-native-queue-asyncstorage => 1.2.1 react-native-reanimated: ~2.2.0 => 2.2.4 react-native-safe-area-context: 3.3.2 => 3.3.2 react-native-screens: ~3.8.0 => 3.8.0 react-native-svg: 12.1.1 => 12.1.1 react-native-torch: ^1.2.0 => 1.2.0 react-native-vector-icons: ^9.0.0 => 9.1.0 react-native-web: 0.17.1 => 0.17.1 rn-swipe-button: ^1.3.6 => 1.3.6 tree-util: ^1.0.6 => 1.0.6 uuid: ^8.3.2 => 8.3.2 npmGlobalPackages: @aws-amplify/cli: 7.6.20 expo-cli: 5.1.1 n: 8.0.1 npm: 8.1.4 react-native-cli: 2.0.1 yarn: 1.22.17 ``` We've been troubleshooting for a little over a week now with no success, so any pointers are greatly appreciated. If there's any additional information I can provide, I'd be happy to do so. Thanks in advance
1
answers
0
votes
2
views
mike_meyer
asked 3 months ago

Amplify @auth rule on relation

I'm new to Amplify and having trouble configuring @auth rules on a model. The app has two user groups, Event Organisers, and Club Managers. Event Organisers can login and create `Events`. Club Managers can login and create `Teams`, which they can register for `Events`. When a `Team` is registered for an `Event` an `EventRegistration` is created. The models (simplified) look like this: ``` type Event @model @auth(rules: [ # Event organisers create these and can perform CRUD operations. { allow: owner }, # Anyone logged into the system can view events, so they can register. { allow: private, operations: [read] }, ]) { id: ID! name: String! # Many teams can register for the same event. eventRegistrations: [EventRegistration!] @hasMany } ``` ``` type EventRegistration @model @auth(rules: [ # Club managers create these when they register their team for an event. Once # created, registrations are read-only from the club managers perspective. { allow: owner, operations: [create, read] } # Event organisers can read and update registrations for their events. { allow: owner, ownerField: "organiser", operations: [read, update] }, ]) { id: ID! organiser: String! event: Event! @belongsTo # I want to make this readable by event organisers, so they can see teams who have # registered for their event. Currently they can't because of the auth rule on Team. team: Team! @belongsTo } ``` ``` type Team @model @auth(rules: [ { allow: owner } ]) { id: ID! name: String! eventRegistrations: [EventRegistration!] @hasMany } ``` The problem is, when an Event Organiser queries a list of registrations for their event, the `team` property is not available, because Event Organisers don't have read access as specified by the `Team` auth rules. Note - Event Organisers shouldn't be able to read all teams, just the those registered for their event. I've thought about a few solutions, but none of them have worked, or felt like the correct way solve the problem. I tried adding field level auth rules to `EventRegistration.team` hoping those would take precedence over the rules defined on `Team`, but that didn't seem to work. One idea is to add `organisers: [String]` to the `Team` model. Then add Event Organisers to the list when a team registers for an event, and remove them when the event is finished, or the team de-registers. But this seems quite error prone, remembering to add / remove access programatically in different scenarios. Event Organisers are also not a concern of the `Team` model, they really belong on `EventRegistration`. I've also considered having a seperate `RegisteredTeam` model which is essentially a copy of the `Team` model, with different auth rules, but duplication seems like a bad idea. [Custom auth rules](https://docs.amplify.aws/cli/graphql/authorization-rules/#custom-authorization-rule) is something else I've seen but haven't dug into yet. I'm hoping something with more Amplify experience than me can recommend a pattern :)
0
answers
0
votes
2
views
flashbackzoo
asked 3 months ago

Amplify GitHub integration failing in ca-central-1

We have multiple Amplify applications running in multiple regions. Yesterday we tried to connect a new branch to an application in ca-central-1. We were sent to the "AWS Console Add Repository Branch" screen, like usual, but then redirected to GitHub where we were asked to install the aws-amplify application. On GitHub we were then asked to pick the specific repositories that AWS-Amplify could access. I had never seen this screen before and it is not the workflow shown in the Amplify documentation. I selected the repositories to which AWS-Amplify ALREADY has access. The workflow stopped at that point; it dit not ask me which branch to connect. I went back to AWS Amplify console and tried again. Same issue. I was not given a chance to choose a branch. I repeated this a few more times. Then I tried it in us-east-1. It worked as normal. Then I tried to create a new web application in ca-central-1. One of the first screens asks me to choose a repository. When I chose GitHub I was sent to GitHub, just like what had happened when I tried to connect a branch in ca-central-1 and the workflow stopped - I could not create the application. I tried to create a new web application using manual deploy. It worked. Now, when I try to connect a branch to the same application that I had problems with yesterday, it works. I found no questions about this when Googling nor any issues reported on the AWS status/health check pages. It started yesterday or on the weekend- we successfully attached new branches and deployed them for the same app/region on the weekend. I'm sorry that I don't have screen shots. This is my first re:Post question and I wanted to see how it works (i.e. are attachments even allowed) prior to gathering that information, and now, of course, things are working. Is anybody aware of any region specific hiccups with AWS-Amplify GitHub integration over the weekend.
0
answers
0
votes
3
views
Jeff
asked 3 months ago
  • 1
  • 90 / page