question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistent render behavior when fetch rejects with net::ERR_SSL_PROTOCOL_ERROR

See original GitHub issue

Describe the bug

The fetch api can reject its returned promise if the server it is fetching data from returns an invalid certificate. While this behavior should result in the <Get> rendering it’s error section, I instead see the progress indicator. While not 100% sure, I believe this is caused by the following line: https://github.com/contiamo/restful-react/blob/v5.2.1/src/Get.tsx#L202 as I figured there was some await call without a catch.

To Reproduce

Option 1:

If this ends up sharing correctly, this should be located here: https://codesandbox.io/s/9p3wmx7po

Option 2:

If using react-scripts, you should be able to switch some api call from http://... to https://....

<RestfulProvider base="https://localhost:8080">
<Get path="/some/api/pets">
{(pets, { loading, error }) =>
    loading ? (
       Loading...
    ) : (
        <div>
        You should only see this after things are loaded.
        {error ? (
            <div>"OH NO!"</div>
        ) : (
            <div>success!</div>
        )}
        </div>
)}
</Get>
</RestfulProvider>

Option 3:

  1. Create a server that returns a different certificate than the domain used to query it (Subject Alternative Name or Common Name is different)
  2. Send a GET request to this server
  3. observe UI behavior

Expected behavior

If the GET request fails because in invalid certificates, the error section should render.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: OSX Darwin Kernel Version 15.6.0
  • Browser Chrome
  • Version v5.2.1

Additional context

There might be other edge cases (maybe CORS or timeouts?) that cause this same behavior though I don’t have any evidence of that.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
TejasQcommented, Oct 30, 2018

@jgensler8, that’s a little strange. Here’s my output from npm test on master:

image

Ah! Good catch! I have discovered the issues after cleaning out my node_modules and treating the project as a fresh clone. I’ll fix up some things and get back to you. Thank you for letting us know about this!

1reaction
fabien0102commented, Dec 13, 2018

If it’s a 200 and the content is available without error, I don’t really see the point to handle this as an error. For now I think it’s should be ok like this, I’ve added a real try/catch on fetch in #97 for network error so it should be more reliable 😃

I will close this issue for now, if you have any edge case where we have an error or anything that are not caught correctly, please open a new issue.

Thanks for the reporting and your reactivity, it’s really appreciate 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the ERR_SSL_PROTOCOL_ERROR - Kinsta
A step-by-step guide on how to fix the ERR_SSL_PROTOCOL_ERROR message. This is typically due to a cached SSL state or misconfigured ...
Read more >
Getting "TypeError: Failed to fetch" when the request hasn't ...
I was testing the response to a lost session and got this error. The REST call sends back a redirect from a different...
Read more >
100 messages from Google Code - Google Groups
Re: Issue 531752 in chromium: Rendering bug in Chrome and Safari - "Domino ... Re: Issue 446699 in chromium: GCM rejects large message...
Read more >
Cisco Firepower Release Notes, Version 6.2.3 - Security
Version 6.2.3 Resolved Issues ; CSCvn76023. Firepower:when deplopy policy, device list is empty with error message "failed to fetch device list" ; CSCvn78174....
Read more >
AWS Support – Knowledge Center
Why do I get the "Access Denied" error when I run a query in Amazon Athena? ... Why isn't CloudFront following a cache...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found