Hello,
Wondering if there is anyway to resolve this specific error code!
const { spawn } = require('node:child_process')
const env = { ...process.env }
;(async() => {
// If running the web server then migrate existing database
if (process.argv.slice(2).join(' ') === 'pnpm run start') {
await exec('npx prisma migrate deploy')
}
// launch application
await exec(process.argv.slice(2).join(' '))
})()
function exec(command) {
const child = spawn(command, { shell: true, stdio: 'inherit', env })
return new Promise((resolve, reject) => {
child.on('exit', code => {
if (code === 0) {
resolve()
} else {
reject(new Error(`${command} failed rc=${code}`))
}
})
})
}
Output:
[info] INFO Starting init (commit: 0b28cec)...
[info] INFO Preparing to run: `/app/docker-entrypoint.js pnpm run start` as root
[info] 2023/06/20 21:23:35 listening on -
[info] npm WARN exec The following package was not found and will be installed: prisma@4.16.0
[info] Prisma schema loaded from schema.prisma
[info] Datasource "db": PostgreSQL database "postgres", schema "public" at "-"
[info] Error: P1011: Error opening a TLS connection: unexpected EOF
[info] /app/docker-entrypoint.js:24
[info] reject(new Error(`${command} failed rc=${code}`))
[info] ^
[info] Error: npx prisma migrate deploy failed rc=1
[info] at ChildProcess.<anonymous> (/app/docker-entrypoint.js:24:16)
[info] at ChildProcess.emit (node:events:513:28)
[info] at ChildProcess._handle.onexit (node:internal/child_process:291:12)