Question

Deploy Strapi on Digital Ocean APP problem

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.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This comment has been deleted

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

  • Edit your Build Command to:

DATABASE_URL=$DATABASE_URL NODE_ENV=production npm run build

Hi @martiinchalupa,

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

Hope this helps.