Prisma1: previousValues -> id result malformed on DELETED subscriptions

Created on 1 Aug 2018  ·  19Comments  ·  Source: prisma/prisma1

Describe the bug
When subscribed to DELETED events, previousValues -> id returns the string CuidGCValue(...). (... represents the actual ID)

To Reproduce
Steps to reproduce the behavior:

  1. Subscribe to DELETED and be sure to query previousValues with the id field:
subscription {
  user {
    previousValues {
      id
    }
  }
}
  1. Delete an entry to trigger subscription.

Expected behavior
The id field should be the actual ID. I suspect a function is being returned as a string rather than being called somewhere in the code.

Versions (please complete the following information):

  • OS: Fedora 28
  • Prisma 1.13.2

First mentioned in #2824.

bu2-confirmed areengine

Most helpful comment

@afrankel-sfdo : Thanks for pinging 🙏 . Thought i merged a fix but i didn't. The fix is available in 1.23.4.

All 19 comments

Just commenting to say I am experiencing this issue as well.

I am able to reproduce this as well. The returned data looks like:

{
  "data": {
    "user": {
      "previousValues": {
        "id": "CuidGCValue(cjkcezgmc00f40884ljcf9asf)"
      }
    }
  }
}

Thanks for reporting! 🙏
I pushed a fix and created a release 1.13.4. Build artifacts will be available in a few minutes.

Hey guys wondering if I am missing something or if this fix is not working. I am currently using a demo server on prisma cloud and UI says it is version 1.18-beta-1. When I lookup 1.18-beta tag in the prisma repo it look like this change is in there (https://github.com/prisma/prisma/commit/ae844618857502a2b9c180c3b3742c6b0b01aedf). In my app I have a subscription for notifications and when I delete a notification I currently still get this:

{
    "data": {
        "notification": {
            "mutation": "DELETED",
            "previousValues": {
                "id": "CuidGCValue(cjmvnu812any60b48oxw07heq)",
                "viewed": false,
                "__typename": "NotificationPreviousValues"
            },
            "node": null,
            "__typename": "NotificationSubscriptionPayload"
        }
    }
}

For now I'm just string replacing this text, but figured I would let you know that it seems to still be happening.

Thanks for reporting the issue and your thorough description! 🙏 This has been fixed in 1.18.1.

@mavilein I'm seeing a similar, but slightly different, issue with delete mutation IDs as StringIdGCValue(ID_HERE). Other mutations (created, edit) are fine.

Tested against 1.18.1


Response:

{  
   "type":"data",
   "id":"1",
   "payload":{  
      "data":{  
         "feedSubscription":{  
            "mutation":"DELETED",
            "node":null,
            "previousValues":{  
               "id":"StringIdGCValue(cjoel023cwjtc0a01bh5awc32)",
               "message":"edited the message! 1542043696120",
               "__typename":"CommentPreviousValues"
            },
            "__typename":"CommentSubscriptionPayload"
         }
      }
   }
}

based on a data model of:

type Comment {
  id: ID! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
  isPublic: Boolean! @default(value: "false")
  message: String!
  author: User!
  children: [Comment!]! @relation(name: "CommentOnComment", onDelete: CASCADE)
  parent: Comment @relation(name: "CommentOnComment", onDelete: SET_NULL)
}

type User {
  id: ID! @unique
  email: String! @unique
  password: String!
  name: String!
  comments: [Comment!]!
}

subscription:

type Subscription {
  feedSubscription: CommentSubscriptionPayload
}

resolver:

const Subscription = {
  feedSubscription: {
    subscribe: (parent, args, ctx, info) => {
      return ctx.db.subscription.comment(
        {
          where: {
            node: {
              isPublic: true
            }
          }
        },
        info
      );
    }
  }
};

@afrankel-sfdo : We indeed had one more regression here. Will reopen and fix soon.

@mavilein any updates? any way I can assist?

Just ran into this issue as well and worked around it like so:

const [, id] = previousValues.id.match(/\((\w+?)\)/);

@afrankel-sfdo : Thanks for pinging 🙏 . Thought i merged a fix but i didn't. The fix is available in 1.23.4.

@mavilein thanks! Upgraded to prisma@^1.23.4 (confirmed via yarn.lock), ran yarn prisma generate then yarn prisma deploy. Restarted the server, but still seeing: id: "StringIdGCValue(cjqia4yt43o2f0991q6zszwmg)" in previousValues on a DELETE mutation.

I noticed this is slightly different from the other reports of CuidGCValue()

Is there some set I'm missing?

@afrankel-sfdo : You just upgraded your Prisma Client dependency. You need to upgrade your Prisma server as well.

@mavilein this is every prisma reference from the server yarn.lock file. Maybe I'm missing something?

afrankel in ~/C/u/server
›» grep "prisma" yarn.lock                                                                                                  07:27:48
    graphql-config-extension-prisma "0.2.5"
[email protected]:
  resolved "https://registry.yarnpkg.com/graphql-config-extension-prisma/-/graphql-config-extension-prisma-0.2.5.tgz#f67db5b6f882ac76096fb2e68a18ec81c7d51fd2"
    prisma-yml "1.20.0-beta.18"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-binding/-/prisma-binding-2.1.6.tgz#b0799ca830f0516bd2d5a3f39f457f2a646dbad2"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-cli-core/-/prisma-cli-core-1.23.4.tgz#136af9c9e1bafae16de9bbd90f452d695ceb5f7f"
    graphql-config-extension-prisma "0.2.5"
    prisma-client-lib "1.23.4"
    prisma-datamodel "1.23.4"
    prisma-db-introspection "1.23.4"
    prisma-generate-schema "1.23.4"
    prisma-yml "1.23.4"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-cli-engine/-/prisma-cli-engine-1.23.4.tgz#1c5e35dc2ddb337551523d91c26012e0f07752da"
    prisma-json-schema "0.1.3"
    prisma-yml "1.23.4"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-client-lib/-/prisma-client-lib-1.23.4.tgz#7437daf9ffd91384de652e1f2575ec42b866900d"
    prisma-datamodel "1.23.4"
    prisma-generate-schema "1.23.4"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-datamodel/-/prisma-datamodel-1.23.4.tgz#c206770f10f5d2f20ae3c838afa4c1d7bf6ff6bf"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-db-introspection/-/prisma-db-introspection-1.23.4.tgz#3d2aedfab5765c4544da1068e565ee88bb4c0fe1"
    prisma-datamodel "1.23.4"
    prisma-yml "1.23.4"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-generate-schema/-/prisma-generate-schema-1.23.4.tgz#bdd6c17bbc4860d77b81d3dbef4198a1ddf044db"
    prisma-datamodel "1.23.4"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-json-schema/-/prisma-json-schema-0.1.3.tgz#6c302db8f464f8b92e8694d3f7dd3f41ac9afcbe"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-yml/-/prisma-yml-1.20.0-beta.18.tgz#fc5f3d2b14f12110e4c64c00305088c5118adb3d"
    prisma-json-schema "0.1.3"
[email protected]:
  resolved "https://registry.yarnpkg.com/prisma-yml/-/prisma-yml-1.23.4.tgz#28a58e16e2914e5cf7dd52c6da1357c73548dafd"
    prisma-json-schema "0.1.3"
prisma@^1.23.4:
  resolved "https://registry.yarnpkg.com/prisma/-/prisma-1.23.4.tgz#1c8cd6945de45adae85d0bb5c43cc6bfa2a94934"
    prisma-cli-core "1.23.4"
    prisma-cli-engine "1.23.4"

@afrankel-sfdo : where did you start your Prisma server? Probably through Docker? If yes, then docker ps will tell you what version you are running.

@mavilein oh, maybe that's the issue... I'm using the deployed Prisma instance. When will that see an upgrade?

@afrankel-sfdo : Do you mean our public demo clusters?

@mavilein I believe so, via yarn prisma deploy

@afrankel-sfdo : The bugfix will be available within the next hour on those servers.

@mavilein looks great, thanks!!

{
   "type":"data",
   "id":"1",
   "payload":{
      "data":{
         "feedSubscription":{
            "mutation":"DELETED",
            "node":null,
            "previousValues":{
               "id":"cjqpcb68e08i00a26nfw0v0co",
               "message":"edited the message! 1547047790512",
               "__typename":"CommentPreviousValues"
            },
            "__typename":"CommentSubscriptionPayload"
         }
      }
   }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

notrab picture notrab  ·  3Comments

jannone picture jannone  ·  3Comments

ragnorc picture ragnorc  ·  3Comments

marktani picture marktani  ·  3Comments

schickling picture schickling  ·  3Comments