aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.83k stars 822 forks source link

Parameters: [s3Key, deploymentBucketName] missing from lambda function resources in team-provider-info.json #11755

Closed guyvanit closed 1 year ago

guyvanit commented 1 year ago

How did you install the Amplify CLI?

npm

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

v14.19.0

Amplify CLI Version

10.6.1

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.

After the issue occurred, amplify-meta.json has been edited and uploaded to the deployment bucket (i.e. the bucket specified in deploymentBucketName, inside team-provider-info.json), in an attempt to see whether running amplify pull after this will download the newly edited file: it does not.

Describe the bug

Parameters: [s3Key, deploymentBucketName] are missing inside team-provider-info.json, for lambda function resources managed by Amplify. Running amplify pull and amplify env pull does not update this information.

This results in a "Parameters: [s3Key, deploymentBucketName] must have values" error when attempting to push changes to these resources through amplify push.

Expected behavior

For parameters: [s3Key, deploymentBucketName] inside team-provider-info.json to be populated upon running amplify pull or amplify env pull. Successful push of changes to these resources.

Reproduction steps

Unfortunately was unable to reproduce this issue with another project, but for this particular project in this specific account:

  1. Run amplify pull to pull this specific project, with backend resources
  2. Perform some changes to one of the lambda function resources (e.g. through amplify update function)
  3. Run amplify push

Project Identifier

1a7997cb95a57bbd0b696159e8a0eaf3

Log output

``` # Put your logs below this line ```

Additional information

Manually editing team-provider-info.json to fill it with the expected parameters: [s3Key, deploymentBucketName] (by going through the deployment bucket and copying object keys) fixes this issue. However, I require a way to fix this without having to manually edit this file myself.

Before submitting, please confirm:

josefaidt commented 1 year ago

Hey @guyvanit :wave: thanks for raising this! Are you using the git-connected workflow with Amplify Hosting by chance?

Additionally, were you noticing this issue on functions that you had previously pushed or is this a brand new function?

guyvanit commented 1 year ago

Hi!

I'm not using git-connected workflow with Amplify Hosting for this project. To deploy the project, I manually deploy through Amplify CLI commands from a CodeBuild.

The issue occurred on functions created previously.

Thank you!

josefaidt commented 1 year ago

Hey @guyvanit apologies for the delay here. Are you still experiencing this issue? Was the amplify-meta.json file manually edited and uploaded to the deployment bucket after experiencing this issue for the first time -- in an attempt to remediate? Were these affected Function resources merged over from another git branch/Amplify environment?

Running amplify env checkout <current-env-name> will refresh the values found in amplify-meta.json with the values from amplify/backend-config.json. Are you able to run this command and get different results?

guyvanit commented 1 year ago

Hi!

Unfortunately, this issue still persists for this specific project and account. I tested this both pre and post-upgrade to amplify CLI version 10.7.3. Note that although I still experience this issue, I also found that the issue can be resolved by re-creating the Amplify project (i.e. deleting the project from AWS Console, then re-deploy the whole project). I'm simply keeping my previous project with this issue up to be able to reproduce this error.

To answer your questions:

josefaidt commented 1 year ago

Hey @guyvanit was this Lambda function previously deployed to this account and environment, but the s3key was not added to the team-provider-info.json? Or is this a case where the function was added, merged over to another environment, and built with Amplify Hosting?

guyvanit commented 1 year ago

Hi,

This lambda function was previously deployed to this account and environment before, but the copy of team-provider-info.json for this particular account and environment was not kept. Upon the attempted generation of a new team-provider-info.json file for this particular account and environment through amplify pull, the s3key was not found.

josefaidt commented 1 year ago

Hey @guyvanit was the team-provider-info file not kept up due to a merge? In any event, though, we can try manually patching in the corresponding s3key by creating a parameter in SSM Parameter Store, then adding this key=value pair to the team-provider-info file, and lastly add the parameter to amplify/backend/backend-config.json. You can refer to this doc for more info around creating the parameter https://docs.amplify.aws/cli/reference/ssm-parameter-store/

Additionally, it may be easier to remove and re-add the function with the same name

josefaidt commented 1 year ago

Closing due to inactivity. @guyvanit if you are still experiencing this please reply back to this thread and we can can re-open this issue to investigate further

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.