gatsbyjs/gatsby-source-wordpress-experimental

Request failed / Client network socket disconnected before secure TLS connection was established

Closed this issue · 1 comments

Hello,

I used the gatsby-starter-wordpress-blog starter and followed the tutorial

I changed the URL in the plugin config in gatsby-config.js like this:

{
  resolve: `gatsby-source-wordpress-experimental`,
  options: {
    url:
      process.env.WPGRAPHQL_URL || `https://mysubdomain.mydomain.org/graphql`,
  },
},

I first got a version error between gatsby-source-wordpress-experimental and the plugins in WordPress, which I fixed by updating gatsby-source-wordpress-experimental from "^3.0.0"to "^6.0.0".

Then I got the following error when running gatsby develop:

ERROR
gatsby-source-wordpress  Client network socket disconnected before secure TLS connection was established

GraphQL request to [my GraphQL URL] failed.

Please ensure the following statements are true
  - your WordPress URL is correct in gatsby-config.js
  - your server is responding to requests
  - WPGraphQL and WPGatsby are installed in your WordPress backend

not finished createSchemaCustomization - 1.772s
not finished  gatsby-source-wordpress  ensuring plugin requirements are met - 1.765s

The WordPress URL is correct and the plugins are installed and activated.

I am not sure how to check if my server is responding to requests, but when I call up the URL in my browser it works (it shows {"errors":[{"message":"GraphQL Request must include at least one of those two parameters: \"query\" or \"queryId\"","extensions":{"category":"request"}}],"extensions":{"debug":[]}})

I looked for existing similar issues but couldn't find an exact match.
Any ideas what could cause the error?

acao commented

it could be that your browser has a cookie that authenticates you, whereas locally it does not?

the error you are seeing, about the network socket disconnecting before secure TLS could be established is quite obscure and hard to diagnoste, and indicates a networking related issue, or possibly an invalid or self signed certificate?

here is a related postman issue, also with an unhelpful response:

https://community.postman.com/t/could-not-get-a-response-error-client-network-socket-disconnected-before-secure-tls-connection-was-established/8968/4

you might try setting this global env variable as such: NODE_TLS_REJECT_UNAUTHORIZED=0 which is a universal way in the node runtime to bypass verification for self signed certificates

this seems like an issue with your network conditions and I don't think we can help you much further than this. best of luck!