SOLVED!
The error:
"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.”