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.

Introspection of remote endpoint throws error without explicit "User-agent" header

See original GitHub issue

I’m trying to perform an introspection and graphql SDL file generation locally using the following configuration:

{
  "name": "Hasura Tutorial GraphQL Schema",
  "schemaPath": "./schema.graphql",
  "extensions": {
    "endpoints": {
      "Default GraphQL Endpoint": {
        "url": "https://hasura.io/learn/graphql",
        "headers": {
          "Authorization": "Bearer <token>"
        },
        "introspect": true
      }
    }
  }
}

“token” above and surrounding brackets are replaced by my auth0 token. Using the above configuration works fine with @graphql-codegen so I know my token, etc. is all working fine. I would just prefer to use this plugin.

Link to Repo with Reproduction or Steps to Reproduce:

  1. Obtain auth token by logging into https://hasura.io/learn/graphql/graphiql
  2. Update .graphqlconfig per the above format along with token
  3. Restart project and get “perform introspection prompt…”; click it
  4. Get the following error: “GraphQL Introspection Error A valid schema could not be built using the introspection result: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $”

Expected behavior Connect to endpoint, perform introspection, and output SDL to “./schema.graphql” file

Version and Environment Details Operation system: MacOS v10.15.6 IDE name and version: Webstorm v2020.1.4 Plugin version: 2.5.0

Additional Context: I’m trying to step through a Hasura GraphQL with React+Typescript tutorial while replacing the use of the @graphql-codegen library with this plugin. The link to the tutorial is https://hasura.io/learn/graphql/typescript-react-apollo/queries/4-mapping-types

Thank you.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
baronyoungcommented, Sep 3, 2020

Ok, I just created a fresh project with nothing other than the standard React and Typescript libraries installed and tried it again. It was successful. My conclusion is there was something with another library I have installed in my other project that was causing the error. Thank you for all your help and sorry for raising an issue that was on my end.

0reactions
majorhayescommented, Feb 5, 2021

I just stumbled upon “error code: 1010” and found this issue so i’d like to add my observation:

Usually i have just one endpoint in my .graphqlconfig and things work without problems. Today i added a second endpoint for temporary use and for this endpoint i receive the error. As suggested in this discussion the error goes away when adding a “user-agent” header with arbitrary content. …

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

I was getting this same error with just 1 remote server configured. I even added a “user-agent” header and it still failed. I changed the header to “User-Agent” and it started working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Log4Shell Zero-Day Vulnerability - CVE-2021-44228 - JFrog
A remote attacker can cause arbitrary strings to be logged, via one of the logging APIs – logger.info() , logger.debug() , logger.error() , ......
Read more >
OpenID Connect (OIDC) authorization code flow mechanism
The Authorization Code Flow mechanism authenticates users of your web application by redirecting them to an OIDC provider, such as Keycloak, to log...
Read more >
node-oidc-provider/README.md at main - GitHub
When oidc-provider cannot fulfill the authorization request for any of the possible reasons (missing user session, requested ACR not fulfilled, prompt requested ...
Read more >
http.connect.User-Agent= - TechDocs
Tests which user agent is used to initiate an explicit proxy HTTP CONNECT request. You cannot use this condition to match a User-Agent...
Read more >
Use AWS WAF to block HTTP requests with no User-Agent ...
To check whether the HTTP request parameters are present or not, do the following: Block requests that don't contain a User-Agent header using ......
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