Report this

What is the reason for this report?

Cloud Apps NodeJS issues with 'fs'

Posted on December 16, 2020

I have been struggling for a few days getting my NodeJS apps built and deployed.

I’ve reached out to support a few times but didn’t get any helpful reply.

My app crashes during build with the following:

error building image:
error building stage:
failed to optimize instructions: 
failed to get files used from context:
failed to get fileinfo for /.app_platform_workspace/settings.json:
lstat /.app_platform_workspace/settings.json:
no such file or directory

This is the Git repo I’m trying to run: https://github.com/healzer/DiscordEarsBot

The message indicates that settings.json is missing, which is correct however the only way I use this file in the code is here:

const SETTINGS_FILE = 'settings.json';


function loadConfig() {
    if (fs.existsSync(SETTINGS_FILE)) {
        const CFG_DATA = JSON.parse( fs.readFileSync(SETTINGS_FILE, 'utf8') );
        ...
    } else {
        ...
    }
}
loadConfig()

Due to the if-condition it shouldn’t read that settings file, and shouldn’t crash if it is missing. I’m assuming something is broken on DO’s side. Because I deploy this repo on Heroku and on my Ubuntu droplet without any problems.



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!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.