cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Can't seedDb with Middleware

By modifying the Grandstack starter v0.0.5 to use middleware with neo4j-graphql-js as outlined in Authentication/Authorization And Middleware, I receive the below error when attempting to mock data in a Neo4j Sandbox via seed-db.js (npm run seedDb). I'm using the "full example" within the docs. The seeding process works fine with the same data mocked out.

I believe express may be injecting sending additional header information which may be causing this issue. If that is the case, any idea on how to disable or strip this information out?

{ Error: Network error: Unexpected token < in JSON at position 0
    at new ApolloError (/GSS/api/node_modules/src/errors/ApolloError.ts:56:5)
    at Object.error (/GSS/api/node_modules/src/core/QueryManager.ts:289:13)
    at notifySubscription (/GSS/api/node_modules/zen-observable/lib/Observable.js:134:18)
    at onNotify (/GSS/api/node_modules/zen-observable/lib/Observable.js:165:3)
    at SubscriptionObserver.error (/GSS/api/node_modules/zen-observable/lib/Observable.js:224:7)
    at /GSS/api/node_modules/apollo-link-http/src/httpLink.ts:165:20
    at process._tickCallback (internal/process/next_tick.js:68:7)
  graphQLErrors: [],
  networkError:
   { SyntaxError: Unexpected token < in JSON at position 0
       at JSON.parse (<anonymous>)
       at /GSS/api/node_modules/apollo-link-http-common/src/index.ts:129:23
       at process._tickCallback (internal/process/next_tick.js:68:7)
     response:
      Response {
        size: 0,
        timeout: 0,
        [Symbol(Body internals)]: [Object],
        [Symbol(Response internals)]: [Object] },
     statusCode: 404,
     bodyText:
      '<!DOCTYPE html>\n<html lang="en">\n<head>\n<meta charset="utf-8">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /</pre>\n</body>\n</html>\n' },
  message: 'Network error: Unexpected token < in JSON at position 0',
  extraInfo: undefined }

1 REPLY 1

William_Lyon
Graph Fellow

Hi @maravillanyc - can you share the middleware code you've added?