Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplify push fails after adding a function #13760

Open
2 tasks done
juri-diener opened this issue May 2, 2024 · 2 comments
Open
2 tasks done

Amplify push fails after adding a function #13760

juri-diener opened this issue May 2, 2024 · 2 comments
Labels
functions Issues tied to the functions category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage

Comments

@juri-diener
Copy link

juri-diener commented May 2, 2024

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v21.7.3

Amplify CLI Version

11.0.5

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

So I added with amplify add function a new lambda function. Added in package.json the "type":"module".
And wrote my function. Then added custom policies to the table and wanted to push the changes, and amplify fails with this error:

This function is the new created one.
In aws.console:
Embedded stack arn:aws:cloudformation:eu-north-1:816334333069:stack/amplify-newapp-dev-c053d-functionacceptOrgFollowing-3DQVL14IIR53/2cb22be0-08bb-11ef-887e-0a25218daa9a5 was not successfully created: The following resource(s) failed to create: [LambdaFunction].

02/05/2024, 21:40:34 | amplify-newapp-dev-c053d | UPDATE_ROLLBACK_COMPLETE | Failed(X)
02/05/2024, 21:40:33 | authnewapp248a1258 (auth) | UPDATE_COMPLETE | -
02/05/2024, 21:40:33 | apinewapp (api) | UPDATE_COMPLETE | -
02/05/2024, 21:38:47 | functionnewapp768a1253PostConfirmation (function) | UPDATE_COMPLETE | -
02/05/2024, 21:38:47 | functioncreateOrgAndEverything (function) | UPDATE_COMPLETE | -
02/05/2024, 21:38:36 | storagenewapp (storage) | UPDATE_COMPLETE | -
02/05/2024, 21:38:35 | amplify-newapp-dev-c053d | UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS

Until this error message below it takes like over 30 minutes until it appears . I don't think this is normal.
Rolled back (6 of 5)
🛑 ["Index: 4 State: {"deploy":"waitingForDeployment"} Message: Resource is not in the state stackUpdateComplete"]

Then I tried to add a new env and tried to push it, and it worked. WHY?
Honestly it's kinda annoying, It really stops me in my development.
Please solve this issue.

Maybe if I did something wrong then every hint is really appreciated.

Expected behavior

Should work after adding Lambda functions

Reproduction steps

amplify add function
amplify update function
Resource access permission
storage
amplify push

Project Identifier

ebfc1cb67b3e849d27a343745c7d5874

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@juri-diener juri-diener added the pending-triage Issue is pending triage label May 2, 2024
@juri-diener
Copy link
Author

juri-diener commented May 2, 2024

I tried to delete the function with amplify remove function and added again: Now I get this error:
🛑 The following resources failed to deploy:
Resource Name: LambdaFunction (AWS::Lambda::Function)
Event Type: create
Reason: acceptOrgFollowing-dev already exists in stack arn:aws:cloudformation:eu-north-1:816395333069:stack/amplify-examplebackendaws-dev-194204-functionacceptOrgFollowing-9ARCKG9E2E5I/24c1ff70-0662-11ef-96d9-0ecc2333e0de6

🛑 Resource is not in the state stackUpdateComplete
Name: LambdaFunction (AWS::Lambda::Function), Event Type: create, Reason: acceptOrgFollowing-dev already exists in stack arn:aws:cloudformation:eu-north-1: 816395333069:stack/amplify-examplebackendaws-dev-194204-functionacceptOrgFollowing-9ARCKG9E2E5I/24c1ff70-0662-11ef-96d9-0ecc2333e0de6

the examplebackendaws is a complete different app. So I don't understand why it's complaining that the function exists. Is it not possible to have the same function name in different projects?

@ykethan
Copy link
Contributor

ykethan commented May 3, 2024

hey @juri-diener, function with the same name cannot be created if the function exists in the region.
image

["Index: 4 State: {"deploy":"waitingForDeployment"} Message: Resource is not in the state stackUpdateComplete"]

It appears the stack failed to update on CloudFormation, could you check the stack events on the CloudFormation console for any notable errors?
additionally, noticed the Amplify CLI version appears to be out of date, could you upgrade the CLI using amplify upgrade.

@ykethan ykethan added functions Issues tied to the functions category pending-response Issue is pending response from the issue author labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions Issues tied to the functions category pending-response Issue is pending response from the issue author pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants