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 pull with function in update status does not recognize env variable and fails on push #13327

Open
2 tasks done
ykethan opened this issue Oct 12, 2023 · 2 comments
Open
2 tasks done
Labels
bug Something isn't working functions Issues tied to the functions category p4

Comments

@ykethan
Copy link
Member

ykethan commented Oct 12, 2023

How did you install the Amplify CLI?

No response

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

No response

Amplify CLI Version

10.6.0

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

creating a function with env variable and running pull with function in update status will not recognize the env variable when running a update.
adding a new env variable will fail on push due to previous env variable ssm parameter

image

Expected behavior

show env variables

Reproduction steps

  1. add function with env variable
  2. push
  3. update function env variable -> say the name
  4. amplify status should show update status
  5. amplify pull
  6. amplify update function
  7. select the same function and the env update config flow
    Observe the env variable is not recognized
  8. lets say we add a new env variable
  9. then run push
    Observe fail on push

Project Identifier

No response

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.
@ykethan ykethan added pending-triage Issue is pending triage functions Issues tied to the functions category labels Oct 12, 2023
@josefaidt
Copy link
Contributor

Confirmed this is an issue. After pull where the function changes are reset, the new env var value is not removed from the associated block in team-provider-info.json

"categories": {
      "function": {
        "13313layer4b041bbe": {
          "deploymentBucketName": "amplify-13313-dev-115443-deployment",
          "s3Key": "amplify-builds/13313layer4b041bbe-LambdaLayerVersion83cfc5da-build.zip"
        },
        "133131b06e745": {
          "deploymentBucketName": "amplify-13313-dev-115443-deployment",
          "s3Key": "amplify-builds/133131b06e745-4470434a696c5a67384e-build.zip",
          "mynewvar": "mynewvalue", // this one
          "myenvvar": "myenvvarvalue",
          "mynewnewvar": "mynewnewvalue"
        }
      }
    }

However, the function-parameters.json is up-to-date:

{
  "lambdaLayers": [],
  "environmentVariableList": [
    {
      "cloudFormationParameterName": "myenvvar",
      "environmentVariableName": "myenvvar"
    },
    {
      "cloudFormationParameterName": "mynewnewvar",
      "environmentVariableName": "mynewnewvar"
    }
  ]
}

Marking as a bug

@josefaidt josefaidt added bug Something isn't working and removed pending-triage Issue is pending triage labels Oct 13, 2023
@josefaidt
Copy link
Contributor

As a workaround, manually remove the reference to the variable in team-provider-info.json and remove the associated SSM Parameter reference in backend-config.json

    "AMPLIFY_function_133131b06e745_mynewvar": {
      "usedBy": [
        {
          "category": "function",
          "resourceName": "133131b06e745"
        }
      ]
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working functions Issues tied to the functions category p4
Projects
None yet
Development

No branches or pull requests

2 participants