Unauthorized staging env since new agent

Hello, i am trying to deploy forest with npm in a new environment, it’s working localy, but when i use it on an aws instance connected to my staging rds i am getting unauthorized when trying to access it. The application is running but when trying to log in i am getting a 401 error. The env secret and auth variables are well set, and i removed the client_id. Do you know if i am dooing anything wrong ?
Thank you !

Hi @Duportet,
In order to help you, I would need some information.
Could you please share the information about your project setup :

  • Project name: …
  • Team name: …
  • Environment name: …
  • Agent (forest package) name & version: …
  • Database type: …

Best regards,


Hello !

  • Project name: trajaan-admin
  • Team name: trajaan
  • Environment name: staging
  • Agent (forest package) name & version: forestadmin/agent version “1.38.7”
  • Database type: psotgresql

Thank you very much !

I am now getting the following error:
options.envSecret is invalid
But my FOREST_ENV_SECRET is the same as in the settings of my env in the configuration page.

Hi @Duportet, sorry for the delays.

Is it only your database that is on AWS or the whole server ?

The database is on rds, and the forest server is deployed on ecs in the same vpc with a docker using the Dockerfile generated by the forest cli.

This documentation page about deploying your agent on AWS could help you.
Tell me if it fits your issue.

The aws config is working, the issue is with the env variable, the service cannot seem to detect it, when i serve the same docker locally, there is no issue in getting the env variable working.

Your environment variable is probably missing on the AWS environment. The agent (server) raises an error when the env secret is not in the right format (options.envSecret is invalid).
Can you share your code to check how you get your environment variables and how you setup the agent? :pray:
Can you add console.log or something like this to check the value of your environments variables during the agent setup?

Thanks a lot, i am now getting:
DatabaseConnectError: Unable to connect to the given uri: postgres://rds-prod.******
Connection error: self-signed certificate in certificate chain
e[31merror:e[0m Forest Admin agent failed to start

Your ssl certificate is self-signed, if you don’t want to verify the certificate, you can pass an option to the datasource. Which datasource do you use ?