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

@vue-storefront/middleware doesn't propagate 4xx errors and returns generic 500 error #6970

Open
bokjo opened this issue Oct 4, 2023 · 0 comments

Comments

@bokjo
Copy link

bokjo commented Oct 4, 2023

Environment

MacOS
Node v20
@vue-storefront/middleware: 3.5.1
@vue-storefront/sdk: 1.1.2

Reproduction

From the frontend app implementation call a SDK endpoint through the middleware that calls external API that returns 401 status code response. The middleware fails with generic 500 error and doesn't propagate the original error and status code.

Describe the bug

Middleware doesn't propagate the original status code and error messages coming from the target API.

api-client fails with: ServerError: Response not successful: Received status code 401

middleware fails with: ServerError: Response not successful. Please, check server logs for more details.

Additional context

No response

Logs

Server

[Middleware] [Network error]: ServerError: Response not successful: Received status code 401
[Middleware] 
[Middleware]  ERROR  Response not successful: Received status code 401
[Middleware] 
[Middleware]   at new ApolloError (/Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:2943:28)
[Middleware]   at /Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:8479:19
[Middleware]   at both (/Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:2329:53)
[Middleware]   at /Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:2322:72
[Middleware]   at new Promise (<anonymous>)
[Middleware]   at Object.then (/Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:2322:24)
[Middleware]   at Object.error (/Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:2331:26)
[Middleware]   at notifySubscription (/Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:1744:18)
[Middleware]   at onNotify (/Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:1783:3)
[Middleware]   at SubscriptionObserver.error (/Users/bojanche/dev/frontend/storefront-sdk/packages/api-client/server/index.js:1836:5)

Browser:

```sh
warn2 @ chunk-QWDWOYML.js:1449
logError @ chunk-QWDWOYML.js:1623
handleError @ chunk-QWDWOYML.js:1615
(anonymous) @ chunk-QWDWOYML.js:1576
Promise.catch (async)
callWithAsyncErrorHandling @ chunk-QWDWOYML.js:1575
invoker @ chunk-QWDWOYML.js:9397
index.es.js:71 Uncaught (in promise) SDKError: Request failed with status code 500
    at handleError (index.es.js:71:12)
    at Proxy.<anonymous> (index.es.js:254:27)
    at async callEndpoint (bundleDetail.vue:36:20)
handleError @ index.es.js:71
(anonymous) @ index.es.js:254
Promise.catch (async)
callWithAsyncErrorHandling @ chunk-QWDWOYML.js:1575
invoker @ chunk-QWDWOYML.js:9397

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant