Deployment is stuck on 'Applying changes' when making a unique optional field required
Before:
type User @model {
id: ID! @unique
nickname: String
firstName: String
lastName: String
auth0UserId: String @unique
facebookMessengerId: String @unique
}
After:
type User @model {
id: ID! @unique
nickname: String
firstName: String
lastName: String
auth0UserId: String! @unique
facebookMessengerId: String @unique
}
Only changing auth0UserId to required is causing that my deploy is never completed. My package.json looks like:
{
"name": "service",
"scripts": {
"start": "nodemon -e js,graphql -x node -r dotenv/config src/index.js",
"debug": "nodemon -e js,graphql -x node --inspect -r dotenv/config src/index.js",
"playground": "graphql playground",
"dev": "npm-run-all --parallel start playground"
},
"dependencies": {
"auth0": "^2.9.1",
"bcryptjs": "2.4.3",
"graphql-yoga": "1.6.1",
"jsonwebtoken": "8.2.0",
"jwks-rsa": "^1.2.1",
"prisma-binding": "1.5.16"
},
"devDependencies": {
"dotenv": "5.0.1",
"graphql-cli": "2.15.8",
"nodemon": "1.17.2",
"npm-run-all": "4.1.2",
"prisma": "1.4.2"
}
}
Thanks @Epotignano, I can reproduce this error on 1.5.1. I added it to this list: #2018.
Note: you don't need to use the @model directive anymore. It is being ignored and has no effect.
I just hit a similar issue, when prisma deploy is stuck at 'applying'. This happened after I changed a field from String to DateTime. The issues dissapeared after I deleted the field, redeployed and readded the field. Not something we can do on a production system though ..
I am hitting this issue more frequently now. I added a field in an existing type and it has got stuck 'applying' while doing a prisma deploy
Deploying service `skpi-app` to stage `dev` on cluster `local` 82ms
Changes:
Player (Type)
+ Created field `dateOfBirth` of type `DateTime!`
Applying changes (6/1) ⢿
On a few more tests, it seems it may possibly be getting stuck because of the field type. When I rename the new field name to something else and try deploying it remains stuck. If I remove the new field altogether, there are no issues. And finally and surprisingly if I change the type from DateTime! to String! the deploy went through smoothly.
Hope this is relevant to help debug the problem...
Deploying service `skpi-app` to stage `dev` on cluster `local` 67ms
Changes:
Player (Type)
~ Updated field `DOB`
Applying changes 1.1s
Your GraphQL database endpoint is live:
HTTP: http://localhost:4466/skpi-app/dev
WS: ws://localhost:4466/skpi-app/dev
Hooks:
Checking, if schema file changed 241ms
Hey @Jaikant, thanks a lot for sharing that information. We are currently collecting different scenarios that end up in a stuck deployment here: #2018. Note that all of them can be worked around at manually.
This issue is about changing a unique field from optional to required. Could you please create a new issue with the new scenarios you have found to work inconsistently?
Thanks! 🙌
Setting a unique constraint will error if there are already duplicates present in the case of a field update or if a new field is required and unique since SQL will set default values for the newly required fields. I'm closing this issue since it seems to show symptoms of this problem. With the deploy changes from 1.6.1 and this PR the issue should be fixed https://github.com/graphcool/prisma/pull/2371 If anyone is still experiencing problems please open a new issue with a reproduction.