Open marktani opened 6 years ago
Comment by marktani Thursday Nov 09, 2017 at 19:12 GMT
When I do these steps (locally):
types.graphql
types.graphql
I get this error message:
There are issues with the new service definition:
Global ✖ No field with id 'cj9sudcag05hu0109g78ixtoy'
But not the error you are reporting. Anyway, that's a reproducible problem 🙂
Comment by vincenzo Thursday Nov 09, 2017 at 23:32 GMT
@marktani
I got that too, initially. Let me explain further.
First, the PR describes a bug that occurs after this sequence:
In your case, you stopped at the second step, and your deployment was never successful. This is because when you pass from the initial to the later types, dangling references for the type Role
are left scattered around; at the very least you should have the following left in your graphcool.yml
:
- operation: Role.create
- operation: Role.update
- operation: Role.delete
- operation: UserOnRole.*
In my original case I also had a permission query still referencing the type Role
. Either way, when you get rid of the dangling references, your force-deploy as per the second step of my sequence above will succeed.
Once you have that, then you must restore the original types, and try to deploy them again. It was then that I got the issue I describe in this PR, and to work around it I had to destroy the docker containers and redeploy, which worked.
Comment by marktani Friday Nov 10, 2017 at 08:38 GMT
dangling references for the type Role are left scattered around; at the very least you should have the following left in your graphcool.yml
No, my graphcool.yml
looks like this:
permissions:
- operation: "*"
So, there are no dangling references to Role
as far as I can see.
Comment by vincenzo Friday Nov 10, 2017 at 08:41 GMT
@marktani LOL, ok, so that makes it even more interesting, because when I got the error you got, I solved it by removing dangling references. It was @kbrandwijk that suggested to me to look into that (starting from the permission query). :D Anyway, it should be possible to make the latter types deploy correctly after the former were deployed already. Until you get to that point, you won't be able to then go to third step of restoring the former types. :)
Comment by Timopheym Wednesday Dec 27, 2017 at 15:33 GMT
@vincenzo @marktani Sorry, i've got the same error, how can i make it work!?((
Comment by Timopheym Wednesday Dec 27, 2017 at 15:41 GMT
I was in need to remove @rename derectives after changing schema
I got the same error when changing a property from type String to a custom type with a relation. Before: education: String After: education: Education @relation(...) Then I stepped back and first deleted education and deployed, then add the same property with the new type, then it was successful. So it seems like the issue is changing the type in one deploy.
I'm receiving this error as well. Changing anything in my models and then deploying results in this error. I must first remove the model, deploy, then add the model back in with the changes and deploy again.
Update: I tried not making any changes and deploying the same exact definition and I get the same error. Not sure if I'm not just understanding how to deploy changes are add any migration directives.
Issue by vincenzo Thursday Nov 09, 2017 at 18:08 GMT Originally opened as https://github.com/graphcool/prisma/issues/1231
Background
I used to have a functional version of my service, which code I had checked into my local repo. This service had
Role
as a type, with an N:M relationship with theUser
type. A permission query exploiting this relationship was also in place.Once I had all that working, I wanted to try to turn
Role
into an enum, after reading some docs. After removing all references to the old Role type, I managed to deploy the new version successfully (local). However, I had missed that currently there is a limitation that affects my use case, so I resolved to revert back to my original functional service, which used to deploy just fine.The issue
It's at this point that the bug appeared. Deploying (even with
--dry-run
) that same version of the service gives now this error:Debug output
Types, before and after
Original working
types.graphql
:Types modified with
Role
asenum
:Diff between the two