Prisma1: Installing a Server-side subscription fails

Created on 16 Feb 2018  路  12Comments  路  Source: prisma/prisma1

Bug Report

Current behavior

When I define a server-side subscription query in my prisma.yml and try to prisma deploy it to my local, cluster I receive the following response:

ERROR: Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjdq6pu0o001d0143keb01hmj

{
  "data": {
    "deploy": null
  },
  "errors": [
    {
      "message": "Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cjdq6pu0o001d0143keb01hmj",
      "path": [
        "deploy"
      ],
      "locations": [
        {
          "line": 2,
          "column": 9
        }
      ],
      "requestId": "cluster:cluster:cjdq6pu0o001d0143keb01hmj"
    }
  ],
  "status": 200
}

This is from the cluster logs: https://gist.github.com/akoenig/e247bd79748c720007db1390a205f7b1

I'm using 1.3.0-beta.1

My prisma.yml:

service: my-service

stage: ${env:PRISMA_STAGE}

secret: ${env:PRISMA_SECRET}

datamodel: ...

cluster: ${env:PRISMA_CLUSTER}

subscriptions:
  userChangedFirstName:
    webhook:
      url: https://server-side-subscription.localtunnel.me/
      headers:
        Content-Type: application/json
        Authorization: Bearer foobar
    query: |
      {
        profile(where: {
          mutation_in: [UPDATED]
        }) {
          node {
            firstName
          }
        }
      }

seed:
  import: utils/seed.graphql

Expected behavior?

The server-side subscription should be deployed 馃榾

bu2-confirmed

Most helpful comment

Thanks, I can confirm! @divyenduz also prepared a reproduction here: https://github.com/divyenduz/server-side-subscriptions

We'll look into this soon.

All 12 comments

Thanks, I can confirm! @divyenduz also prepared a reproduction here: https://github.com/divyenduz/server-side-subscriptions

We'll look into this soon.

+1

We are investigating this issue. Until then, a workaround is to manually trigger an endpoint with the required data from a mutation resolver in your application server.

@marktani Thanks for investigating this issue. :) Another workaround is to implement an own separate service that subscribes via WebSockets natively and sends the respective HTTP requests respectively.

Which version of prisma has this fix?

@rohitghatol I guess you should see the change in 1.4-beta-16 (Docker image), because there is no stable release with this commit yet. You can switch to the unstable channel via:

  • npm i prisma@beta / yarn add prisma@beta
  • prisma local upgrade

Thanks @akoenig. I'll add that information to the README soon 馃檪

I just checked if the error persists in the current 1.4-beta (1632e97e1f97) image. When registering the following subscription

subscriptions:
  userChangedFirstName:
    webhook:
      url: http://192.168.0.10:9999/
      headers:
        Content-Type: application/json
    query: |
      {
        user(where: {
          mutation_in: [UPDATED]
        }) {
          node {
            profile {
              firstName
            }
          }
        }
      }

I get a The provided query doesn't include any known model name. error, when performing a prisma deploy. The subscription works in Playground though. Strange :/

Thanks @akoenig

@do4gr will take a look at this again tomorrow.

This looks like this one: #1649.
Did you try to first deploy the data model, and then the subscription, @akoenig?

@sorenbs Thanks for diving into it again.

@marktani Yeah, that was also my first thought. I did deploy the data model and the subscription afterwards.

This is now fixed and available in 1.4.0 馃檪 Thanks a lot for your help with this, everyone 馃憣

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sedubois picture sedubois  路  3Comments

jannone picture jannone  路  3Comments

ragnorc picture ragnorc  路  3Comments

marktani picture marktani  路  3Comments

schickling picture schickling  路  3Comments