Hi.
I’m having an issue with multiple account deployments with Serverless.
I have two accounts configured as local profiles: test
and production
.
I’m using these profiles for a lot of things and they’ve worked fine for a long time. But I’m new with Serverless, so maybe I don’t quite understand what’s going on. I have the following config (truncated):
org: example
app: example
service: example
frameworkVersion: '3'
provider:
name: aws
runtime: nodejs14.x
region: eu-west-1
vpc:
subnetIds: ${self:custom.subnets.${self:custom.stage}, self:custom.subnets.other}
securityGroupIds:
- { Ref: ExampleLambdaSecurityGroup }
environment:
NODE_OPTIONS: "--require ./.pnp.cjs"
SEQUELIZE_HOST: ${ssm:/postgres-${opt:stage}/DbHost}
SEQUELIZE_PASSWORD: ${ssm:/postgres-${opt:stage}/DbPassword}
Originally, I tried deploying this to my test profile and so far it worked fine. Now I was ready to deploy to my production profile, and I’m having issues with the Parameter Store values. It’s almost as if Serverless is looking at the wrong account/profile.
This is the output:
$ serverless deploy --stage production --aws-profile production --verbose [8:59:41]
Environment: darwin, node 19.5.0, framework 3.26.0, plugin 6.2.2, SDK 4.3.2
Credentials: Serverless Dashboard, "123456789123-sls_dashboard" provider (https://app.serverless.com/example/apps/example/example/production/eu-west-1/providers)
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Cannot resolve serverless.yml: Variables resolution errored with:
- Cannot resolve variable at "provider.environment.SEQUELIZE_HOST": Value not found at "ssm" source,
- Cannot resolve variable at "provider.environment.SEQUELIZE_PASSWORD": Value not found at "ssm" source
I know the variables exist - and even hardcoding them just to reference them directly yields the same error. I tried adding --verbose
to the command in hopes that I could get some more information, but it doesn’t provide more output.
Might someone know what I’m doing wrong?