Serverless deployed environment variables do not update

Viewed 374

The app is a nodejs app deployed to AWS Lambda using Serverless. I have the production environment variables stored in .env-prod.json

serverless.yml:

custom:
  stage: ${opt:stage, self:provider.stage}

service: my-backend
provider:
  name: aws
  runtime: nodejs14.x
  stage: prod
  region: us-east-1
  memorySize: 128
functions:
  app:
    handler: index.handler
    environment: ${file(./.env-${self:custom.stage}.json)}
    events: 
      - http: 
          path: /
          method: ANY
          cors: true
      - http: 
          path: /{proxy+}
          method: ANY
          cors: true

.env-prod.json:

{
  "ENVIRONMENT": "prod",
  "TEST1": "abc",
  "TEST2": "abc2"
}

For the first serverless deploy I had only TEST1 var present and this deployed successfully. Now, after I added TEST2 var, then run serverless deploy, it does not deploy the new variable or any change to a variable, only code and code changes. In order to change or add a new var, I have to go to the AWS console UI and do it there.

Is there some special way to re-deploy the variables? I have tried the force option which had no effect.

0 Answers
Related