I have a node app and ran fly launch. It created a docker-entrypoint.js file and includes a line to a variable that isn’t defined. What is the target supposed to be?
Fly logs:
file:///app/docker-entrypoint.js:10
const newDb = target && !fs.existsSync(target)
^
ReferenceError: target is not defined
at file:///app/docker-entrypoint.js:10:17
Section from docker-entrypoint.js:
// If running the web server then migrate existing database
if (process.argv.slice(-3).join(' ') === 'npm run start') {
const newDb = target && !fs.existsSync(target)
if (newDb && process.env.BUCKET_NAME) {
await exec(`litestream restore -config litestream.yml -if-replica-exists ${target}`)
}
await exec('npx prisma migrate deploy')
}
That looks like a bug, and I’d like to fix it. By any chance, are you using prisma, and can you share the datasource portion of your schame.prisma file?
A correct docker-entrypoint.js would look something like this:
There will be a lot of variation on this theme, bases on things like if your app is "type": "module" or not.
Based on the example file that you showed I switched my schema.prisma file to use a hardcoded value instead of an environment variable then recreated the fly app. This generated the right source and target.