Moving from beta versions of agent and datasource-sql

Feature(s) impacted

Nest.js application with forest admin module crashes due to openid authentication error.
It was developed using beta versions of agent and datasource-sql modules.
How do I properly move to a stable version

Observed behavior

Forest admin module is mounted on nest.js application


… and crashes with openid error on startup

Expected behavior

Perviously this setup was working perfectly. Need a way to bypass this error, or some guidance for how to move to the current versions keeping the app configuration.

Context

  • Project name: ??? - can’t check, since admin panel is not reachable
  • Team name: ??? - can’t check, since admin panel is not reachable
  • Environment name: production
  • Agent (forest package) name & version: “@forestadmin/agent”: “^1.0.0-beta.43”, “@forestadmin/datasource-sql”: “^1.0.0-beta.40”,
  • Database type: Postgresql
  • Recent changes made on your end if any: none

Hello @Oleksandr_Medvedskyy,

You should be able to update your version easily with:
yarn add @forestadmin/agent @forestadmin/datasource-sql
From what I can see, there shouldn’t be any issue with the configuration you have already declared.

Best regards,

@dogan.ay hey!
Thank you for your reply!
I’ve tried your suggestion, and still getting few errors:

  • There was also Collection ==> CollectionCustomizer ts-type replacement, that I’ve figured already.

  • Probably koa__router can be fixed by yarn add @types/koa__router or @types/koa-router - please advise.

  • agentUrl property in createAgent options is now probably changed to forestServerUrl, right?

  • still have no clue what to do with the SequelizeReference error.

Thanks in advance!

Yes, agentUrl has been replaced by forestServerUrl, for the other errors, they are from generated files in you node_modules from the beta version, could you remove node_module for forest packages at least and restart your agent ?

I did remove and reinstalled all modules, so that’s not from beta, I’m positive about that.
This is the only remaining issue for now:

Our type checking is not set to strict which can cause you issues, you can set https://www.typescriptlang.org/tsconfig#skipLibCheck to true to fix this issue

1 Like

Thanks, this helps.

In Nest applications its disabled by default, so I’ve added “skipLibCheck”: true in ts-config file.

However the app is still crashing with this error:

I haven’t changed the credentials to the admin project since last time it was working…
Only change made was here:

  const admin = createAgent({
    authSecret: process.env.FOREST_AUTH_SECRET,
    forestServerUrl: process.env.FOREST_AGENT_URL, //agentUrl ==> forestServerUrl
    envSecret: process.env.FOREST_ENV_SECRET,
    isProduction: process.env.NODE_ENV === 'production',
    loggerLevel: 'Error'
  })

Any ideas what else could go wrong?

This is related to the FOREST_ENV_SECRET defined in your .env, could you please share with me the last 4 chars of your secret ?

Yes, it’s for production environment:
231d

Can you confirm that this variable is set in your process.env ? Maybe you are missing the following import ?

import 'dotenv/config';

All correct, nothing was changes since the time it was working.

I am able to log those values right before the createAgent call, so they are definitely present.

Alright I got it, could you please delete the forestServerUrl, I mixed it up with another variable. You do not need to set it as a user. Sorry for the inconvenience

1 Like

OK, now I’m getting this error:

Could you share with me your .forestadmin-schema.json file, if you are reluctant to share it openly you can send it via private message.

Sent the schema file in PM

Could you please restart your server with the NODE_ENV as dev to regenerate your schema, the one you sent still uses the old template and is incompatible with the newer versions.

EDIT: or simply set isProduction to false

1 Like

Ok, this seems to resolve the issue!
I’ve set NODE_ENV to dev and started the app locally, schema file got updated (sending newer version in PM).
After that, with new schema I’ve changed NODE_ENV back to production to make sure it will work when deployed.
All went well and we’re back live in deployed production mode as well!

@dogan.ay greatly appreciate your help!

1 Like