question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use graphiql at all when having this error: 'length' of undefined at getToken

See original GitHub issue

I’m actually not sure if I should post this here or for express-graphql as I’m using express-graphql, but since this error is coming from graphiql.min.js, I’m posting this issue here.

Situation

Occasionally, the graphiql will get the below error in console, and then Documentation Explorer will keep spinning and graphiql will become unusable. Most cases I found command + c/v to copy and paste in the QUERY VARIABLES panel will cause the problem. After it happens, I won’t be able to use graphiql for a while, doesn’t work even hard refresh the page. Then it will just work again after a long time.

Uncaught TypeError: Cannot read property 'length' of undefined
    at getToken (graphiql.min.js:4)
    at Object.token (graphiql.min.js:4)
    at nt (graphiql.min.js:7)
    at lt (graphiql.min.js:7)
    at Qe (graphiql.min.js:7)
    at Je (graphiql.min.js:7)
    at ht (graphiql.min.js:7)
    at At (graphiql.min.js:7)
    at Pt (graphiql.min.js:7)
    at Tn (graphiql.min.js:8)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gespositocommented, Mar 9, 2017

I’m not sure why, but invoking localStorage.clear() didn’t solve this issue for me. I solved this by disabling (graphiql: false), clearing the storage, and enabling GraphiQL again from express-graphql.

0reactions
Davidxiaoshuocommented, Jun 6, 2018

++ exec apollo-codegen generate --schema schema.json --output API.swift TypeError: Cannot read property ‘length’ of undefined at Object.yargs.command.command.command.argv [as handler] (/Users/bohaishuo/.nvm/versions/node/v7.0.0/lib/node_modules/apollo-codegen/src/cli.js:186:16) at Object.runCommand (/Users/bohaishuo/.nvm/versions/node/v7.0.0/lib/node_modules/apollo-codegen/node_modules/yargs/lib/command.js:235:44) at Object.parseArgs [as _parseArgs] (/Users/bohaishuo/.nvm/versions/node/v7.0.0/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:1013:30) at Object.get [as argv] (/Users/bohaishuo/.nvm/versions/node/v7.0.0/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:957:21) at Object.<anonymous> (/Users/bohaishuo/.nvm/versions/node/v7.0.0/lib/node_modules/apollo-codegen/lib/cli.js:197:5) at Module._compile (module.js:573:32) at Object.Module._extensions…js (module.js:582:10) at Module.load (module.js:490:32) at tryModuleLoad (module.js:449:12) at Function.Module._load (module.js:441:3) Command /bin/sh failed with exit code 1

I also have this problem, can you tell me the detailed solution?

Read more comments on GitHub >

github_iconTop Results From Across the Web

updated query returns undefined in apollo - Stack Overflow
I'm using Observable for updating token when its expiered.the process works properly and when token has been expiered it'll send a request ...
Read more >
graphql_flutter | Flutter Package - Pub.dev
A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
Read more >
JSON Web Token Tutorial using AngularJS & Laravel - Toptal
Amazing tutorial! I'm having some issues though, basically I can't perform Ajax requests to my api subdomain as I keep getting csrf token...
Read more >
Nuxt GraphQL Authentication With Strapi - Hash Interactive
GraphQL has changed the way we think about API endpoints and is ... We walk through using GraphQL to authenticate a user in...
Read more >
Resolve Microsoft Graph authorization errors
This error often means that the access token may be missing in the HTTP authenticate request header or that the token is invalid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found