You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can not fetch https API url inside getInitialProps
Describe the bug
Login.getInitialProps = async ({ req }) => {
const res = await fetch(
'https://domain.com/api',
{ headers: req.headers }
);
const data = await res.json();
return {
data
};
};
request to https://domain.com/api failed, reason: write EPROTO 4459447744:error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error:../deps/openssl/openssl/ssl/s23_clnt.c:802:
FetchError: request to https://domain.com/api failed, reason: write EPROTO 4459447744:error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error:../deps/openssl/openssl/ssl/s23_clnt.c:802:
at ClientRequest.<anonymous> (/Users/duc/dev/rm-web/node_modules/node-fetch/lib/index.js:1444:11)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at onwriteError (_stream_writable.js:417:12)
at onwrite (_stream_writable.js:439:5)
at _destroy (internal/streams/destroy.js:39:7)
at TLSSocket.Socket._destroy (net.js:568:3)
at TLSSocket.destroy (internal/streams/destroy.js:32:8)
at WriteWrap.afterWrite [as oncomplete] (net.js:870:10)
A clear and concise description of what the bug is.
Expected behavior
It somehow should work, and return the right result.
Screenshots
System information
OS: macOS
Browser (if applies) Chrome
Version of Next.js: [e.g. 6.0.2] ^8.0.0-canary.18
The text was updated successfully, but these errors were encountered:
This doesn't sound like a Next.js issue, as Next.js doesn't implement fetch, you're importing a library for it, eg isomorphic-fetch or isomorphic-unfetch.
With relation to the error, by putting EPROTO into google:
Bug report
Can not fetch https API url inside getInitialProps
Describe the bug
A clear and concise description of what the bug is.
Expected behavior
It somehow should work, and return the right result.
Screenshots
System information
The text was updated successfully, but these errors were encountered: