I’m in the process of migrating serverless project v2.40 to v3.21 but I’m facing issue like loading env variable to the serverless. Earlier, we’re serverless-dotenv-plugin to support each .env file each stage(eg. .env.development for development, .env.staging for staging, .env.production for production). Now, we’re facing this kind of below error because serverless couldn’t able to env variables.
Error:
Cannot resolve serverless.yml: Variables resolution errored with:
- Cannot resolve variable at "provider.region": Value not found at "env" source,
- Cannot resolve variable at "provider.apiGateway.apiKeys.0": Value not found at "env" source,
- Cannot resolve variable at "provider.apiGateway.apiKeys.1": Value not found at "env" source,
- Cannot resolve variable at "custom.sentry.dsn": Value not found at "env" source,
Environment:
Node.js - v16
Serverless- v3.21
yarn: v1.21.1