Hello,
We recently made some changes to our DB schema and would like to see these fields on the forestadmin portal. The DB entries are pulling correctly but still displaying the old fields only.
I have been trying to update the schema on my localhost in order to push these changes to our deployed staging and production environments but without success. Each time I try and run forest schema:update I get the following error:
× Cannot connect to the database due to the following error:
× {“name”:“MongoServerSelectionError”,“reason”:{“type”:“Unknown”,“setName”:null,“maxSetVersion”:null,“maxElectionId”:null,“servers”:{},“stale”:false,“compatible”:true,“compatibilityError”:null,“logicalSessionTimeoutMinutes”:null,“heartbeatFrequencyMS”:10000,“localThresholdMS”:15,“commonWireVersion”:null}}
I deleted and re-added the development environment so the forest secret env vars are correct. I have NODE_ENV set to “development” and DATABASE_URL pointing to our dev MongoDB (format = mongodb://username:password@dev.connectionplaceholder.mongodb.net:27017/devDB)
I’m working with a whitelisted IP and have tested with the DB connection open. I’ve also tested the DB connection URL in MongoDB Compass and I can connect successfully and view the DB.
I’ve hit a complete wall with troubleshooting this and would appreciate any assistance in figuring this out.
- Project name: LSD Hedgehog
- Environment: Development
Hello @Daniel_HollandRamsay,
Thanks for reaching out
I can confirm that we never received any schema from your local environment (Development | noldortechnologies
).
Could you please tell me:
- Did you try to simply start this server (you should not be required to use the
forest schema:update
at all here, the server start should be computing the schema and sending it to our servers)?
- Do you have the exact same code between your local environment and your production (apart from a few environment variables)?
Thanks.
@anon34731316 Thanks for the swift response.
When starting my local server and attempting to access it from app.forestadmin.com I see the following error message in the CLI:
I’m connected to a whitelisted VPN so I’m not sure what’s causing this issue.
Authentication on the frontend seems to be successfull but then displays on the dashboard:
I can confirm that apart from FOREST_AUTH_SECRET, FOREST_ENV_SECRET and APPLICATION_PORT the variables are the same (using the live versions of DATABASE_URL and NODE_ENV is set to production now).
We do have a custom schema folder set up using FOREST_SCHEMA_DIR inside a folder at root/schema (not sure if this could be part of the issue).
@Daniel_HollandRamsay,
You definitely need to keep your NODE_ENV=development
for this instance (when set to “production”, the schema is not sent).
Great news though, we just received the first schema synchronization of this environment. So it worked when you started your agent.
Now, I’m not sure why you’re seeing this error and if it limits you to do some actions.
Your development environment should have the same layouts than your production environment. Is it the case?
Then, you can just create a branch, make some layout changes, and deploy them to production.
Let me know!
Cheers.
@anon34731316 I’ve set the NODE_ENV to development but still getting the same error.
I see the schema on app.forestadmin.com on the data tab is still the old schema, none of the new fields are showing. It looks like the only change to .forestadmin-schema.json is the orm_version but none of the fields are pulling from the DB most likely due to the connection error.
I’ve tried running the development environment using the main branch so there shouldn’t be any differences there.
Thanks again for your assistance.
Ok so I guess it’s needed to fix your connection server issue to MongoDB atlas cluster.
I’m not an expert on this, could you check if you see any logs on altas side / if you could set something up to fix this?
You might want to try this just to see if it resolves the problem (and then you might want to be a bit more specific).
Let me know!