Skip to content

Graphql Mongo db connector ID failure #457

Closed
@ZachHaber

Description

@ZachHaber

I tried to follow the examples (which are out of date, so I tried looking through the different packages to get things working). I managed to get apollo server's playground running queries and mutations, but this error occurs. For some reason mongodb's ObjectId type doesn't seem to be working correctly.
Any help as to why this is happening would be appreciated. I can post the server code that I put together if it helps. I've also tried setting the mongo connector's "convertSession/UserIdToMongoObjectId" to both false and true, and neither helped.

{
  "data": {
    "register": null
  },
  "errors": [
    {
      "message": "ID cannot represent value: { _bsontype: \"ObjectID\", id: <Buffer 5b 9a 87 cb c0 98 4a 69 08 1c c6 d9> }",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "register"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "TypeError: ID cannot represent value: { _bsontype: \"ObjectID\", id: <Buffer 5b 9a 87 cb c0 98 4a 69 08 1c c6 d9> }",
            "    at GraphQLScalarType.serializeID [as serialize] (\\node_modules\\graphql\\type\\scalars.js:212:9)",
            "    at completeLeafValue (\\node_modules\\graphql\\execution\\execute.js:641:37)",
            "    at completeValue (\\node_modules\\graphql\\execution\\execute.js:587:12)",
            "    at \\node_modules\\graphql\\execution\\execute.js:500:16",
            "    at <anonymous>",
            "    at process._tickCallback (internal/process/next_tick.js:188:7)"
          ]
        }
      }
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions