Database error: error parsing response from server: `S` field missing

Hello everyone, I'm trying to use Xata for an app (Umami) I'm trying to deploy to Vercel. Vercel seems to be able to connect to the database (according to logs), but then I get this error:
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
✗ Command failed: prisma migrate deploy
Error: P3018
A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
✗ Command failed: prisma migrate deploy
Error: P3018
A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
and I have no idea how to work around it. I don't have another PostgreSQL instance I can use to test if it's a specific database issue or an app problem. I have already reported the issue to Umami but I haven't got a reply yet. Do you know if this could be related to some Xata limitation? Thanks
47 Replies
kostas
kostas3mo ago
Hi, the failed command is "prisma migrate deploy". Does that work when run locally? Prisma migrate requires a shadow database, in addition to the target xata database. You can read more about it here: https://xata.io/docs/integrations/prisma#shadow-database-for-migrations Have you set up the shadow database?
andreagrandi
andreagrandi3mo ago
hi and thanks for your reply. I'm new to Vercel to be honest and very little experience with NodeJS stuff (I'm a Python backend dev as a daily job). Coming to your quesiton: I haven't tried prisma migrate deploy locally because I don't run the app locally, I'm trying to deploy directly to Vercel, following these instructions https://umami.is/docs/guides/running-on-vercel I'm also not aware of what a "shadow" db is but I'm going to read that document in a moment... going to create it now, hold on ok, umami-migrations created and added the SHADOW_DATABASE url to Vercel. Retrying deploy... I just don't get this step: configure this database's Postgres connection string as the shadowDatabaseUrl in the Prisma datasource
kostas
kostas3mo ago
You can see a more complete example in the Prisma docs here: https://www.prisma.io/docs/orm/prisma-migrate/understanding-prisma-migrate/shadow-database#cloud-hosted-shadow-databases-must-be-created-manually Basically, you need the Postgres endpoint of the Xata database in the "url", and the Postgres endpoint of the additional shadow database (which is used by Prisma to store migration information) in "shadowDatabaseUrl"
andreagrandi
andreagrandi3mo ago
I did set both env variables and rerun the deployment. But now I got a different error in Vercel:
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
✗ Command failed: prisma migrate deploy
Error: P3018
A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
✗ Command failed: prisma migrate deploy
Error: P3018
A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
Migration name: 01_init
Database error code: none
Database error:
error parsing response from server: `S` field missing
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "check-db" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1
and on Xata dashboard I see this:
No description
andreagrandi
andreagrandi3mo ago
uhm...no well the error is the same as before, sorry
kostas
kostas3mo ago
The fact that it created a _prisma_migrations table means that it did pick up the shadow db which is good
andreagrandi
andreagrandi3mo ago
but it was creating that table even before and it created it on umami not on umami-migrations
kostas
kostas3mo ago
Ah then it didn't pick it up
andreagrandi
andreagrandi3mo ago
I even tried to apply this, previously
No description
kostas
kostas3mo ago
Adapting isn't going to help, this is to make the tables render in Xata
andreagrandi
andreagrandi3mo ago
and it does some changes as it says... then if I re-run, a row is written to the table, but it cannot complete the migration. So I was deleting that row every time to make it clean
kostas
kostas3mo ago
what is your workspace id so I can check logs on our end?
andreagrandi
andreagrandi3mo ago
Andrea-Grandi-s-workspace-5jfka8 (and yes, I checked Allow support to view your workspace) thanks 🙏🏻
kostas
kostas3mo ago
It is failing on this step: CREATE EXTENSION IF NOT EXISTS "pgcrypto";
andreagrandi
andreagrandi3mo ago
never used/heard
Want results from more Discord servers?
Add your server