It almost seems like the Managed Database is not connected to the application for some reason.
Any ideas on what I can do to resolve this error?
This topic has been created from a Discord post (1265349758508339241) to give it more visibility.
It will be on Read-Only mode here. Join the conversation on Discord
If I delete the DATABASE_URL and DATABASE_CA (*That I manually created), and if I go to the console I can run printenv DATABASE_URL and printenv DATABASE_CA. Those values are returned in the console.
"Could not load js config file /workspace/config/env/production/database.js: Cannot read properties of undefined (reading 'charAt')"
This clearly tells us there was a problem reading or finding the process.env.DATABASE_URL variable in the config/env/production/database.js file, and has it coming back as undefined.
Although, we know that we can still access the variable using printenv DATABASE_URL using DO’s console.
Step 1: I manually added back the DATABASE_URL and DATABASE_CA per the youtube instructions. So it looks like the image I posted in the original images with this issue.
Step 2: (see images attached to this) There were actually multiple DATABASE_URL’s with different scopes! You can see that the manual one I entered has a scope of RUN_AND_BUILD_TIME while the one that was created automatically by Digital Ocean when I connected my managed database just has RUN_TIME.
Solve 1: I deleted the one that was created automatically by Digital Ocean.
Solve 2: Delete manual ones, but change the scope to RUN_AND_BUILD_TIME
Resources for solution:
In the official documentation there was a WARNING! that helped lead me here:
In the Forum there was a comment that led me to this solution:
“in the config .yaml file (under a second envs key). In my case there where 3 DATABASE_URL variables because I changed connected DBs. I had to delete all of them to make my manually set DATABASE_URL (the connection string) env working again.”