graphql-boilerplates / typescript-graphql-server

Boilerplate code for scalable, production-ready GraphQL servers written in TypeScript
741 stars 111 forks source link

Deployment Error with Boxed Error #197

Open juicycleff opened 6 years ago

juicycleff commented 6 years ago
Checking, if schema file changed !

ERROR: Boxed Error

{
  "errors": [
    {
      "message": "Boxed Error",
      "requestId": "api:api:cjfnvn2m6mf0n0b62e001snv5"
    }
  ],
  "status": 500
}

After a new prisma init, deployment to the cloud fails with Boxed error. Old projects deploy fine.

marktani commented 6 years ago

Which cluster are you deploying to?

juicycleff commented 6 years ago

To prisma-us1

juicycleff commented 6 years ago

So @marktani I figured it out. It was syntax error on my end but to help anyone that gets this error, It means your db schema is bad and in my case here is the issue i added the unique directive to a field of type User

type Answers{ id: ID! @unique question: Questions! @relation(name:"QuestionAnswers") user: User! @unique value: OptionsEnum! }

The unique directive on the user of type User there which I placed accidentally was the issue. So boxed error is a syntax error

marktani commented 6 years ago

Thanks, that's super helpful! I'll try to reproduce this and report in the Prisma repo.

marktani commented 6 years ago

I can't reproduce this, can you share your entire datamodel?

BatuhanW commented 6 years ago

@marktani You can reproduce this error like this;

type Profile {
  id: ID! @unique
  user: User! @unique
  name: String!
  username: String! @unique
}

Notice user type here. It's not field, it's relation.

In my case I intentionally did that, because I want every user to have single profile. How can I achieve this?

marktani commented 6 years ago

That discussion provides further context: https://www.graph.cool/forum/t/graphql-prepare-issue-again/3414?u=nilan

marktani commented 6 years ago

In my case I intentionally did that, because I want every user to have single profile. How can I achieve this?

@BatuhanW, you cannot mark list or relation fields as @unique 🙂

marktani commented 6 years ago

Note that this error is returned when running graphql get-schema --project db.