Datamodel 1.1: @id(strategy: SEQUENCE) causing query issue


#1

I added a new field to my 1.1 datamodel:

Desk {
   ...other fields
   number: Int! @id(strategy: SEQUENCE)
}

According to datamodel-v1.1-feedback, there is an example which is similar to mine:

type User {
  myID: Int! @id(strategy: SEQUENCE) @sequence(name: "MY_SEQUENCE" initialValue: 1 allocationSize: 100)
  name: String!
}

As you can see in my example, I don’t employ the @sequence directive — and I’m curious if that is an issue. My service deployed successfully without errors, so I assume it deployed fine.

Unfortunately, there’s currently no documentation on this directive in your blog post or your docs — please point me to more robust documentation if you have some.

This is an issue because when I try to query this field in Prisma Admin, I get the follow issue when I include the number field on type Desk:

[
  {
    "message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:cjvhiddi202yw0706dtz09euw",
    "path": [
      "desks"
    ],
    "locations": [
      {
        "line": 2,
        "column": 3
      }
    ],
    "requestId": "local:cjvhiddi202yw0706dtz09euw"
  }
]

I have server logs, but do not want to publish them here. You can reach me directly on Prisma’s slack if you need them.


#2

After discussing with @pantharshit00 offline, the issue was that I did not include a required @sequence directive. This is a bug with the CLI that allowed me to deploy w/o it. That bug has been filed here:

Additionally, if those are curious about what allocations mean in @sequence directives mean, @pantharshit00 has an explanation here. Fwiw, I set my initialValue and allocationSize to 1.


#3

Unfortunately adding the @sequence directive did not help.

For reference, this is the updated datamodel:

Desk {
   ...other fields
   number: Int!
    @id(strategy: SEQUENCE)
    @sequence(name: "DESK_SEQUENCE", initialValue: 1, allocationSize: 1)
}

I can still not query or mutate against type Desk due to the number field. Any help would be appreciated. Just tried in the playground and received this error:

{
  "data": null,
  "errors": [
    {
      "message": "Whoops. Looks like an internal server error. Search your server logs for request ID: local:cjvigtvy30hzk070677c7v10u",
      "path": [
        "createDesk"
      ],
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "requestId": "local:cjvigtvy30hzk070677c7v10u"
    }
  ]
}

For reference:
Datamodel: 1.1
Prisma Server: 1.32.0 running on AWS Fargate
Prisma CLI: prisma/1.32.2 (darwin-x64) node-v11.2.0


#4

This is being tracked here: https://github.com/prisma/prisma/issues/4555

I am able to reproduce this.