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

Endpoint returns 500 after updating to Node 20.15 #237

Open
5 tasks done
twalshOG opened this issue Dec 16, 2024 · 0 comments
Open
5 tasks done

Endpoint returns 500 after updating to Node 20.15 #237

twalshOG opened this issue Dec 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@twalshOG
Copy link

twalshOG commented Dec 16, 2024

Software versions

Please provide at least OS and version of pact-js

  • OS: Ubuntu 22.04 and macOS 14 Arm64
  • Pact Node version: "@pactflow/pact-msw-adapter": "3.0.1"
  • Node Version: v20.16.0
  • Other Versions: Most versions above v20.16.0 (got as high as v22 and stopped checking at that point) - works on v21.7.3

Issue Checklist

Please confirm the following:

  • I have upgraded to the latest
  • I have the read the FAQs in the Readme
  • I have triple checked, that there are no unhandled promises in my code
  • I have set my log level to debug and attached a log file showing the complete request/response cycle
  • For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem

Expected behaviour

The unit test would pass as MSW retuned the expected response

Actual behaviour

The unit test fails because MSW returns a 500 error.

Steps to reproduce

See: https://github.com/twalshOG/pact-msw-adapter-bug/actions/runs/12362599164
Basically just run with different node version.

Relevant log files

image
Locally:

Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
AxiosError: Network Error
 ❯ XMLHttpRequest.handleError node_modules/axios/lib/adapters/xhr.js:110:14
 ❯ XMLHttpRequest.methodCall node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts:194:20
 ❯ Proxy.<anonymous> node_modules/@mswjs/interceptors/src/utils/createProxy.ts:93:29
 ❯ XMLHttpRequestController.trigger node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts:530:16
 ❯ XMLHttpRequestController.errorWith node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts:484:10
 ❯ XMLHttpRequestController.xhrRequestController.onRequest node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestProxy.ts:98:32
 ❯ processTicksAndRejections node:internal/process/task_queues:95:5
 ❯ Axios.request node_modules/axios/lib/core/Axios.js:45:41
 ❯ processTicksAndRejections node:internal/process/task_queues:95:5
 ❯ fetchData app/AnimalsTable.tsx:13:36
     11|   useEffect(() => {
     12|     const fetchData = async () => {
     13|         const animal: IAnimal[] = (await API.getAllAnimals())?.data;
       |                                    ^
     14|         setAnimal(animal);
     15|     };

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { description: undefined, number: undefined, fileName: undefined, lineNumber: undefined, columnNumber: undefined, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http', 'fetch' ], transformRequest: [ 'Function<transformRequest>' ], transformResponse: [ 'Function<transformResponse>' ], timeout: +0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: 'Function<FormData>', Blob: 'Function<Blob>' }, validateStatus: 'Function<validateStatus>', headers: { Accept: 'application/json, text/plain, */*', Authorization: 'Bearer 2024-12-16T21:48:40.114Z' }, method: 'get', url: 'http://localhost:3030/v2/animals' }, code: 'ERR_NETWORK', status: undefined }
This error originated in "tests/AnimalTable.pact.test.tsx" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
The latest test that might've caused the error is "renders table with a peice of content and capture pact". It might mean one of the following:
- The error was thrown, while Vitest was running this test.
- If the error occurred after the test had been completed, this was the last documented test before it was thrown.

In GitHub pipeline

  [pact-msw-adapter] Checking request against url filters
    {
      urlString: 'http://127.0.0.1:3030/v2/animals',
      providerFilter: true,
      includeFilter: true,
      excludeFilter: true,
      matchIsAllowed: true
    }
    [pact-msw-adapter] Matching request
      [pact-msw-adapter] {"url":"http://127.0.0.1:3030/v2/animals"}
      Response: GET http://127.0.0.1:3030/v2/animals received 500 Unhandled Exception
......
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
AxiosError: Request failed with status code 500
 ❯ settle node_modules/axios/lib/core/settle.js:19:12
 ❯ XMLHttpRequest.onloadend node_modules/axios/lib/adapters/xhr.js:59:7
 ❯ XMLHttpRequest.methodCall node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts:[206](https://github.com/OpenGov/qce-skunkworks/actions/runs/12358460745/job/34489024716#step:5:207):20
 ❯ Proxy.<anonymous> node_modules/@mswjs/interceptors/src/utils/createProxy.ts:93:29
 ❯ XMLHttpRequestController.trigger node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts:630:16
 ❯ finalizeResponse node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts:420:12
 ❯ readNextResponseBodyChunk node_modules/@mswjs/interceptors/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts:436:11
 ❯ processTicksAndRejections node:internal/process/task_queues:95:5
 ❯ Axios.request node_modules/axios/lib/core/Axios.js:45:41
 ❯ processTicksAndRejections node:internal/process/task_queues:95:5
 ❯ fetchData app/AnimalsTable.tsx:13:36
     11|   useEffect(() => {
     12|     const fetchData = async () => {
     13|         const animal: IAnimal[] = (await API.getAllAnimals())?.data;
       |                                    ^
     14|         setAnimal(animal);
     15|     };

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { description: undefined, number: undefined, fileName: undefined, lineNumber: undefined, columnNumber: undefined, config: { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http', 'fetch' ], transformRequest: [ 'Function<transformRequest>' ], transformResponse: [ 'Function<transformResponse>' ], timeout: +0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: 'Function<FormData>', Blob: 'Function<Blob>' }, validateStatus: 'Function<validateStatus>', headers: { Accept: 'application/json, text/plain, */*', Authorization: '***' }, method: 'get', url: 'http://127.0.0.1:3030/v2/animals' }, code: 'ERR_BAD_RESPONSE', status: 500 }
@twalshOG twalshOG added the bug Something isn't working label Dec 16, 2024
@twalshOG twalshOG changed the title Endpoint returns 500 after updated Node about 20.15 Endpoint returns 500 after updating to Node 20.15 Dec 18, 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