Question
Cloud Apps NodeJS issues with 'fs'
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.