Jakob Fix
12/04/2021, 10:45 AMversion value of the package.json file in my lambda script. Therefore, as described in the documentation, I edited the index.js file in the stacks directory, to contain this bit of code:
export default function main(app) {
// Set default runtime for all functions
app.setDefaultFunctionProps((stack) => ({
runtime: "nodejs12.x",
environment: {
SCRIPT_VERSION: process.env.npm_package_version,
CALENDAR_ID: ssm.StringParameter.valueForStringParameter(stack, "/CALENDAR_ID"),
....
SCRIPT_VERSION should now contain the value of version. This works fine while developping locally, but once deployed, the value is always undefined . Is the package.json file ignored maybe? 🙏Frank
npm_package_version environment variable come from?Jakob Fix
12/04/2021, 7:35 PMFrank
Frank
npx sst deploy instead of npm run deploy. And I just tried running npx and npm_package_ environment variable is not set.Jakob Fix
12/05/2021, 1:33 PMnpx sst deploy --stage prod .Frank
npm run deploy -- --stage prodFrank
npm_package_ environment variable only applies to npm runJakob Fix
12/06/2021, 10:58 PMJakob Fix
12/06/2021, 11:02 PM