Question

Deploy Strapi on Digital Ocean APP problem

Posted January 10, 2022 119 views
Node.jsDeploymentBuilding on DigitalOceanStrapi

Greetings Guys,

I have a problem regarding Strapi deployment to Digital Ocean using „new“ APP approach. I have followed an official tutorial from Strapi developers here.
I have fulfilled the described steps and I’m having this issue during build time:

Error: Could not load js config file /workspace/config/env/production/database.js: Cannot read properties of undefined (reading 'charAt')

Full log:

[2022-01-10 16:40:14] > backend@0.1.0 build
[2022-01-10 16:40:14] > strapi build
[2022-01-10 16:40:14] 
[2022-01-10 16:40:17] Error: Could not load js config file /workspace/config/env/production/database.js: Cannot read properties of undefined (reading 'charAt')
[2022-01-10 16:40:17]     at loadJsFile (/workspace/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:18:11)
[2022-01-10 16:40:17]     at loadFile (/workspace/node_modules/@strapi/strapi/lib/core/app-configuration/load-config-file.js:35:14)
[2022-01-10 16:40:17]     at /workspace/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js:16:18
[2022-01-10 16:40:17]     at Array.reduce (<anonymous>)
[2022-01-10 16:40:17]     at module.exports (/workspace/node_modules/@strapi/strapi/lib/core/app-configuration/config-loader.js:13:6)
[2022-01-10 16:40:17]     at module.exports (/workspace/node_modules/@strapi/strapi/lib/core/app-configuration/index.js:56:21)
[2022-01-10 16:40:17]     at new Strapi (/workspace/node_modules/@strapi/strapi/lib/Strapi.js:54:23)
[2022-01-10 16:40:17]     at module.exports (/workspace/node_modules/@strapi/strapi/lib/Strapi.js:492:18)
[2022-01-10 16:40:17]     at module.exports (/workspace/node_modules/@strapi/strapi/lib/commands/build.js:18:26)
[2022-01-10 16:40:17]     at /workspace/node_modules/@strapi/strapi/bin/strapi.js:52:14
[2022-01-10 16:40:17]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[2022-01-10 16:40:17] building: exit status 1
[2022-01-10 16:40:17] ERROR: failed to build: exit status 1
[2022-01-10 16:40:48] 
[2022-01-10 16:40:48] For documentation on the buildpacks used to build your app, please see:
[2022-01-10 16:40:48]    Node.js: https://do.co/apps-buildpack-node
[2022-01-10 16:40:48] 
[2022-01-10 16:40:48]  ! Build failed

Please Help.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi @martiinchalupa,

I’ve been there as well. Here is a discussion and my final solution.

Hope this helps.

The problem is that DATABASE_URL variable is not pushed on the command invoke. This worked for me.

  • Edit your Build Command to:

DATABASEURL=$DATABASEURL NODE_ENV=production npm run build