How do I debug release command failures?

Hi friends! I’m setting up a new Node Fly app, and I’m running into an issue with my release command I’m trying to debug.

My command is yarn prisma migrate deploy.

I’m getting these logs:

	 Starting instance
	 Configuring virtual machine
	 Pulling container image
	 Unpacking image
	 Preparing kernel init
	 Configuring firecracker
	 Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
	 Preparing to run: `launcher yarn prisma migrate deploy` as heroku
	 2022/06/27 23:54:32 listening on [fdaa:0:71a7:a7b:8aeb:93f0:75eb:2]:22 (DNS: [fdaa::3]:53)
	 Main child exited normally with code: 127
	 Starting clean up.

I’m not sure what’s going on here, and I can’t find any logs to help. 127 usually means the command isn’t found, but I’m not sure why yarn wouldn’t be available.

Is there a way to get richer logs from whatever is running the release command? (Also, what is running the release command?)

FWIW, if I ssh into the machine, and run launcher yarn prisma migrate deploy, it also says yarn: yarn: command not found, and if I run su -c 'launcher yarn prisma migrate deploy', I get bash: launcher: command not found.

More debugging: if I set the release command to yarn --version, I still get a 127. Maybe yarn isn’t installed? Do I need to use npm?

Figured it out; that was indeed the problem.

For future reference: Heroku decides whether to use yarn or npm based on the presence of a yarn.lock. I switched over to a monorepo recently, and yarn puts yarn.lock in the root of the repo instead of in each workspace. Because I’m only deploying the server, yarn.lock no longer exists in the directory being deployed, which meant yarn wasn’t used, so the commands above failed.

In general, would still be nice to have better logging on the release command.

1 Like

I think the release command logs streams to your app’s logs. You should be able to find the whole logs there.

Not sure if it helps much in this case. I think that would’ve been part of the builder logs where it mentions what “things” it detected.

I have a similar problem. Also trying to execute prisma migrate, also a mono repo, also getting error 127, no further log.
How did you solve it exactly? I’m running npx prisma migrate deploy as release_command.

Hey!

I don’t know a ton about Heroku buildpacks but I have a couple ideas based on what was mentioned earlier.

127 usually means bash can’t find the executable. Something tells me 127 is npx saying it can’t find yarn or possibly the prisma executable. It sounds like if the buildpack doesn’t detect a yarn.lock at the root it won’t get installed. That might also mean that it tried to install using npm but didn’t install things since there was no package-lock.json (only a yarn.lock).

To start, it might be worth changing the release command to debug whether yarn got installed by the buildpack. To do that you could change your release command to something like:

release_command = "which yarn; npx prisma migrate deploy"

Then deploy to see what the logs output.

If the logs on that release indicate it can’t find yarn, you could probably trick it into installing yarn or maybe simpler to just use npm.

If you were to do a npm install in your project you’d get a package-lock.json file. With that you might be able to rely on npm for running the script. In which case npx prisma migrate deploy might “just work” - I’m not sure! We might have more tinkering to do.

If you post back here whether it works we can try to help you out.