[GH-ISSUE #894] TypeError: Cannot read property 'startsWith' of undefined - after getting 401 response #314

Closed
opened 2026-03-16 14:39:53 +03:00 by kerem · 3 comments
Owner

Originally created by @jonasbark on GitHub (May 24, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/894

Originally assigned to: @AndrewBastin on GitHub.

Describe the bug
Javascript error after sending request.

To Reproduce
Javascript error:

TypeError: Cannot read property 'startsWith' of undefined
    at a.default.e.transformResponse (chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:60)
    at chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:10
    at Object.B [as forEach] (chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:4)
    at module.exports (chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:10)
    at chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:44

Without the extension:

TypeError: Cannot read property 'startsWith' of undefined
    at regeneratorRuntime.mark.regeneratorRuntime.wrap.h.transformResponse (c4f4c8737a6876cf35a9.js:1)
    at 90e58649f81013ae3376.js:2
    at Object.h [as forEach] (90e58649f81013ae3376.js:2)
    at t.exports (90e58649f81013ae3376.js:2)
    at 90e58649f81013ae3376.js:2

HTTP Response from the server:

Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Vary: Access-Control-Request-Headers
WWW-Authenticate: Bearer error="invalid_token", error_description="Token is expired!", error_uri="https://tools.ietf.org/html/rfc7662#section-2.2"
Request-Context: appId=cid-v1:d2b4a858-2f54-433c-8776-c6a2c7cfbfb9
Access-Control-Allow-Origin: *
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Powered-By: ASP.NET
Set-Cookie: ARRAffinity=2f82fcda71047f2cee039aca2508dd3ba4f1da517325421091357c6b28aa93c6;Path=/;HttpOnly;Domain=ffuf-springboot-aggregator-r-13379xyc732u.azurewebsites.net
Date: Sun, 24 May 2020 07:57:25 GMT
Content-Length: 0

By default Spring Boot does not send a response body for unauthorized requests - so no content-type is included in the response header I guess.

Expected behavior
401 HTTP error message

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Version: 81

I can share the URL + Headers for the request privately if needed :)

Originally created by @jonasbark on GitHub (May 24, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/894 Originally assigned to: @AndrewBastin on GitHub. **Describe the bug** Javascript error after sending request. **To Reproduce** Javascript error: ``` TypeError: Cannot read property 'startsWith' of undefined at a.default.e.transformResponse (chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:60) at chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:10 at Object.B [as forEach] (chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:4) at module.exports (chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:10) at chrome-extension://amknoiejhlmhancpahfcfcfhllgkpbld/index.js:44 ``` Without the extension: ``` TypeError: Cannot read property 'startsWith' of undefined at regeneratorRuntime.mark.regeneratorRuntime.wrap.h.transformResponse (c4f4c8737a6876cf35a9.js:1) at 90e58649f81013ae3376.js:2 at Object.h [as forEach] (90e58649f81013ae3376.js:2) at t.exports (90e58649f81013ae3376.js:2) at 90e58649f81013ae3376.js:2 ``` HTTP Response from the server: ``` Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 Vary: Access-Control-Request-Headers WWW-Authenticate: Bearer error="invalid_token", error_description="Token is expired!", error_uri="https://tools.ietf.org/html/rfc7662#section-2.2" Request-Context: appId=cid-v1:d2b4a858-2f54-433c-8776-c6a2c7cfbfb9 Access-Control-Allow-Origin: * X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block X-Frame-Options: DENY X-Powered-By: ASP.NET Set-Cookie: ARRAffinity=2f82fcda71047f2cee039aca2508dd3ba4f1da517325421091357c6b28aa93c6;Path=/;HttpOnly;Domain=ffuf-springboot-aggregator-r-13379xyc732u.azurewebsites.net Date: Sun, 24 May 2020 07:57:25 GMT Content-Length: 0 ``` By default Spring Boot does not send a response body for unauthorized requests - so no content-type is included in the response header I guess. **Expected behavior** 401 HTTP error message **Desktop (please complete the following information):** - OS: macOS - Browser: Chrome - Version: 81 I can share the URL + Headers for the request privately if needed :)
kerem 2026-03-16 14:39:53 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@liyasthomas commented on GitHub (May 24, 2020):

Hi @jonasbark ,
can you try force reloading the web app and see whether issue exists or not?

<!-- gh-comment-id:633195198 --> @liyasthomas commented on GitHub (May 24, 2020): Hi @jonasbark , can you try force reloading the web app and see whether issue exists or not?
Author
Owner

@jonasbark commented on GitHub (May 24, 2020):

Still happens - I only discovered Postwoman yesterday, so it's probably not a cache issue :)

<!-- gh-comment-id:633195420 --> @jonasbark commented on GitHub (May 24, 2020): Still happens - I only discovered Postwoman yesterday, so it's probably not a cache issue :)
Author
Owner

@AndrewBastin commented on GitHub (May 24, 2020):

Oops I get the problem.

I will roll out a patch in an hour or so.

It will take a day or two to get this bug fixed on the extensions though (Chrome Web Store verification takes time)

The new transformResponse code expects a content type header to be present which was not there in the request, hence startsWith ran against null.

<!-- gh-comment-id:633200513 --> @AndrewBastin commented on GitHub (May 24, 2020): Oops I get the problem. I will roll out a patch in an hour or so. It will take a day or two to get this bug fixed on the extensions though (Chrome Web Store verification takes time) The new transformResponse code expects a content type header to be present which was not there in the request, hence startsWith ran against null.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#314
No description provided.