Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

responseByStatusCode doesn't treat 404 as expected #4803

Open
4 tasks
gilgardosh opened this issue Nov 10, 2022 · 0 comments
Open
4 tasks

responseByStatusCode doesn't treat 404 as expected #4803

gilgardosh opened this issue Nov 10, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@gilgardosh
Copy link
Collaborator

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

When defining responseByStatusCode with schema for 404 responses, it misses it and throw.

To Reproduce
Steps to reproduce the behavior:

Set config

responseByStatusCode:
  200:
    responseSchema: ./src/schemas.json#/definitions/goodResponse
  400:
    responseSchema: ./src/schemas.json#/definitions/errorResponse
  404:
    responseSchema: ./src/schemas.json#/definitions/errorResponse

200 and 400 works fine, 404 throws error:

GraphQLError: HTTP Error: 404, Could not invoke operation GET /api/
    at Object.createGraphQLError (./node_modules/@graphql-tools/utils/cjs/errors.js:9:12)
    at field.resolve (./@omnigraph/json-schema/index.js:664:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 0)
    at async promiseForObject (./node_modules/@graphql-tools/executor/cjs/execution/promiseForObject.js:14:28)
    at async ./node_modules/@graphql-tools/batch-execute/cjs/createBatchingExecutor.js:44:36
    at async Promise.all (index 0)
    at async DataLoader.batchExecuteLoadFn [as _batchLoadFn] (./node_modules/@graphql-tools/batch-execute/cjs/createBatchingExecutor.js:42:25) {
  path: [ 'getExpense' ],
  locations: undefined,
  extensions: {
    http: { status: 404, statusText: 'Not Found', headers: {} },
    request: {
      url: 'https://api',
      method: 'GET'
    },
    responseJson: { errorCode: 404, errorMessage: 'error message' }
  }
}

Expected behavior

To recognize this response :)

@gilgardosh gilgardosh added the bug Something isn't working label Nov 10, 2022
@theguild-bot theguild-bot mentioned this issue Nov 10, 2022
@theguild-bot theguild-bot mentioned this issue Sep 28, 2023
This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant