Giter VIP home page Giter VIP logo

Comments (4)

glb-cblin avatar glb-cblin commented on May 30, 2024

A bit more context : it seems to happen only for operations with a return type marked as "JSON"

Examples :

query me { identity: GetUser { id } } 
=> I receive an error
"errors": [
    {
      "message": "HTTP Error: 401, Could not invoke operation <redacted>",

query systemStatus {
  SystemStatus
}
=> I do NOT receive an error
{
  "data": {
    "SystemStatus": ""
  }
}

The only difference I can see is that the query SystemStatus is defined like SystemStatus: JSON whereas the query GetUser has a "proper" return GetUser: UserInfo

from graphql-mesh.

ardatan avatar ardatan commented on May 30, 2024

Could you give more details about your setup? What kind of source are you using? OpenAPI? SOAP? GraphQL?
For GraphQL, GraphQL Mesh forwards the response as-is.
For OpenAPI, only if there is a response for 401 status code, GraphQL Mesh returns the exact response. GraphQL Mesh throws an error if there is no defined response in the OpenAPI spec for that specific status code.
If you don't want Mesh to handle other status codes, you can set ignoreErrorResponses: true so in that case Mesh will only handle 2xx status codes, and throw others.

from graphql-mesh.

glb-cblin avatar glb-cblin commented on May 30, 2024

I'm using OpenAPI

Below is the extract of the OpenApi for both operations (they are in the same source)

note : I cannot provide the whole doc as is, I'd need to clean everything except these 2 operations, please ask if needed

None of them specify the 401 return code, so it should throw based on your explanation

I do want graphql mesh to handle the described errors (like "400" for example) so I do not want to use ignoreErrorResponses

I'm attaching the logs of Graphql mesh for both queries (I redacted the URLs, the tokens, ...)
logs-graphql-mesh.zip

you will see that the server answers the same response in both cases but the difference is at the end

Extract for the systemStatus
๐Ÿ› ๐Ÿ•ธ๏ธ  Mesh - Identity - Query.SystemStatus   => Return type is not a JSON so returning 

Here is the relevant OpenApi

/systemSstatus:
    get:
      operationId: SystemStatus
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: boolean
            text/json:
              schema:
                type: object
                additionalProperties:
                  type: boolean

/user-info:
    get:
      operationId: GetUser
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserInfo'

from graphql-mesh.

glb-cblin avatar glb-cblin commented on May 30, 2024

Adding the screenshot of the diff

image

from graphql-mesh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.