Fly.io problem after deployment
Hello,
I made deployment to fly.io but i mixed toml files.
I interrupted deploymend process when i saw this missmatch
Right now after deployment app with correct toml i got error probably with prisma.
2024-06-18T12:54:51.486 app[90801932c7dd78] ams [info] Error: P3009
2024-06-18T12:54:51.486 app[90801932c7dd78] ams [info] migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
2024-06-18T12:54:51.486 app[90801932c7dd78] ams [info] The 20240606165441_0606024v2 migration started at 2024-06-18 12:06:55.657890 UTC failed
2024-06-18T12:53:50.809 app[d8dd626f075208] ams [info] > npm run db-migrate-prod && NODE_ENV=production npm run start
2024-06-18T12:53:34.293 proxy[90801932c7dd78] ams [info] Starting machine
2024-06-18T12:53:34.295 proxy[90801932c7dd78] ams [error] [PM07] failed to change machine state: machine still active, refusing to start
2024-06-18T12:53:56.645 proxy[d8dd626f075208] ams [info] Starting machine
2024-06-18T12:53:56.647 proxy[d8dd626f075208] ams [error] [PM07] failed to change machine state: machine still active, refusing to start
2024-06-18T12:53:37.337 proxy[90801932c7dd78] ams [info] Starting machine
2024-06-18T12:53:37.339 proxy[90801932c7dd78] ams [error] [PM07] failed to change machine state: machine still active, refusing to start
2024-06-18T12:53:59.623 proxy[d8dd626f075208] ams [info] Starting machine
2024-06-18T12:53:59.624 proxy[d8dd626f075208] ams [error] [PM07] failed to change machine state: machine still active, refusing to star
Patching & hotfixing | Prisma Documentation
How to reconcile the migration history after applying a hotfix or patch to a production environment.
4 Replies
Hi @Kbk. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It seems like you're encountering a Prisma migration error after deploying your Wasp app to Fly.io. The error message suggests that there are failed migrations in your database, and new migrations will not be applied until these are resolved.
Here are a few steps you can take to troubleshoot this issue:
1. Check your Prisma setup: Ensure that you have correctly set up Prisma in your Wasp project. If you recently updated Prisma from v2 to v3, make sure the update was successful and didn't introduce any issues (source (https://github.com/wasp-lang/wasp/issues/359)).
2. Resolve failed migrations: The error message provides a link to Prisma's documentation on how to resolve migration issues in a production database. Follow the instructions provided in the linked documentation (https://pris.ly/d/migrate-resolve).
3. Check your
fly.toml
file: Make sure you have correctly set up your fly.toml
file and it's in the right location. When you rebuild your Wasp app with wasp build
, it will remove your .wasp/build/
directory, which may contain a fly.toml
file from any prior Fly.io deployments. You can copy the fly.toml
file to a versioned directory, like your Wasp project dir, or back it up somewhere before running wasp build
, and copy it into .wasp/build/
after (source (https://wasp-lang.dev/docs/advanced/deployment/manually#redeploying-after-wasp-builds)).
4. Check your app name: If you're using wasp deploy launch
, make sure the app name you're using is unique across all of Fly.io. If the name is not unique, a new, random unique name will be created instead, which can cause the deploy script to fail (source (https://github.com/wasp-lang/wasp/issues/1588)).
5. Check your server logs: Use the flyctl logs
command to check your server logs for any additional error messages that might help diagnose the issue (source (https://wasp-lang.dev/docs/advanced/deployment/manually#deploy-to-a-flyio-app)).
If you're still encountering issues after trying these steps, consider reaching out to the Wasp community or opening an issue on the Wasp GitHub page for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Kbk, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@kapa.ai server machine is rebooting all time i got this error, its not possible to open console on server
migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
Patching & hotfixing | Prisma Documentation
How to reconcile the migration history after applying a hotfix or patch to a production environment.
Let me check the knowledge base for you. One moment! :books:
----------------------
The error message you're seeing indicates that there are failed migrations in your database. Prisma will not apply new migrations until these failed migrations are resolved. This could be the reason why your server machine is constantly rebooting.
Here's how you can resolve this issue:
1. Resolve Failed Migrations: Follow the instructions provided in the Prisma documentation (https://pris.ly/d/migrate-resolve) to resolve the failed migrations in your database.
2. Check Your Database Setup: Ensure that your database is correctly set up and running. If you're switching from SQLite to PostgreSQL for production, make sure to follow the correct steps as outlined in the Wasp documentation (https://wasp-lang.dev/docs/data-model/backends#migrating-from-sqlite-to-postgresql).
3. Redeploy Your App: After resolving the failed migrations and ensuring your database is correctly set up, try redeploying your app. If you're using Fly.io, you can use the
wasp deploy
command to redeploy your app.
If you're still encountering issues after trying these steps, consider reaching out to the Wasp community or opening an issue on the Wasp GitHub page for further assistance.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Kbk, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@Kbk it is a bit tricky to exactly figure out the issue here: can you just nuke the whole setup and start deployment again? Meaning delete the machines and start from scratch?
Btw how did you end up mixing the toml files, that means you were doing something manually?