Upgrade liana v9 sequelize

Feature(s) impacted

I can’t upgrade forest-express-sequelize from version 8.5.14 to 9.x.x versions. When I do that I get the following error:

Failure Logs

[forest] 🌳🌳🌳  Unexpected error: Invalid value "undefined" for header "forest-secret-key"
{
  "code": "ERR_HTTP_INVALID_HEADER_VALUE",
  "stack": "TypeError: Invalid value \"undefined\" for header \"forest-secret-key\"\n    at ClientRequest.setHeader (node:_http_outgoing:579:3)\n    at Request.request (/Users/x308449/apps/monofolio/common/temp/node_modules/.pnpm/superagent@7.1.5/node_modules/superagent/src/node/index.js:850:39)\n    at Request.end (/Users/x308449/apps/monofolio/common/temp/node_modules/.pnpm/superagent@7.1.5/node_modules/superagent/src/node/index.js:972:8)\n    at /Users/x308449/apps/monofolio/common/temp/node_modules/.pnpm/superagent@7.1.5/node_modules/superagent/src/request-base.js:285:12\n    at new Promise (<anonymous>)\n    at RequestBase.then (/Users/x308449/apps/monofolio/common/temp/node_modules/.pnpm/superagent@7.1.5/node_modules/superagent/src/request-base.js:267:31)"
}

Context

  • Project name: Passfolio
  • Team name: Developers
  • Environment name: Sandbox and Dev
  • Agent (forest package) name & version: forest-express-sequelize@9.0.0

Have,
Have you assigned the value for your FOREST_ENV_SECRET variable in your .env file or in your environment variables?
Did you follow this tutoriel?

You are correct, the problem is that there is a breaking change from 8.5.14 to 9.0.0 which is not listed in your docs. It doesn’t matter if you call Liana.init passing the envSecret, at some point you guys are reading from process.env.FOREST_ENV_SECRET which doesn’t make any sense to me. Any idea why you changed this? I can’t set process.env.FOREST_ENV_SECRET, we get all your secrets at runtime using Google KMS…

await Liana.init({
  configDir: __dirname + '/../../forest',
  schemaDir: __dirname + '/../../..',
  // envSecret is loaded at runtime from Google KMS, not available at process.env.FOREST_ENV_SECRET
  envSecret: kms.settings.FOREST_ENV_SECRET,
  authSecret: kms.settings.FOREST_AUTH_SECRET,
  connections: db.connections,
  objectMapping: db.objectMapping
})

Problem is here:

Wrong:

envSecret: env.FOREST_ENV_SECRET,

Right

envSecret: configStore.lianaOptions.envSecret || env.FOREST_ENV_SECRET,

I will push your feedback as a regression and it will be fixed.
A workaround is to set the env variables before the liana init.

process.env.envSecret = kms.settings.FOREST_ENV_SECRET;
process.env.authSecret = kms.settings.FOREST_AUTH_SECRET;

Ok, that solves the problem for now.

Hello @felipe.prservicos,

We’ve just released a new version of forest-express-sequelize :tada:

Could you update to the latest version and remove the “monkey patch”?

Let us know if it works for you. :pray:

Kind regards,
Morgan

1 Like