Iโve verified that the build succeeds locally, and also built successfully with @netlify/build-image.
However, the deploy preview log shows the following error:
$ yarn build
yarn run v1.22.19
$ docusaurus build
[INFO] [en] Creating an optimized production buildโฆ
[ERROR] Unable to build website for locale en.
[ERROR] Error: socket hang up
at connResetException (node:internal/errors:717:14)
at TLSSocket.socketOnEnd (node:_http_client:526:23)
at TLSSocket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[INFO] Docusaurus version: 2.2.0
Node version: v18.14.0
error Command failed with exit code 1. (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
info Visit yarn run | Yarn for documentation about this command.
Hi, sorry I thought you would be able to get the site name from the deploy log link.
The site name is resoto, and here are the build settings (let me know if you need additional details):
It is also worth noting that it is this single PR/branch that is failing to build. It is fetching some JSON documents from https://cdn.some.engineering at build time, resulting in the socket hang up error. However, the build succeeds outside of Netlify.
Hi, @someengineer. Your repo is public so I cloned it and tested building the exact commit with the error. This is what I get in a local Ubuntu VM (which is not using Netlify in any way):
$ yarn build
yarn run v1.22.5
$ docusaurus build
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ Update available 2.2.0 โ 2.3.1 โ
โ โ
โ To upgrade Docusaurus packages with the latest version, run the following command: โ
โ `yarn upgrade @docusaurus/core@latest @docusaurus/plugin-pwa@latest @docusaurus/plugin-sitemap@latest @docusaurus/preset-classic@latest @docusaurus/theme-mermaid@latest @docusaurus/module-type-aliases@latest` โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
[INFO] [en] Creating an optimized production build...
[ERROR] Unable to build website for locale en.
[ERROR] Error: Client network socket disconnected before secure TLS connection was established
at connResetException (node:internal/errors:717:14)
at TLSSocket.onConnectEnd (node:_tls_wrap:1595:19)
at TLSSocket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[INFO] Docusaurus version: 2.2.0
Node version: v18.14.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This means the error is not being caused by Netlify (because I see it when Netlify is not used). You will need to resolve the issue in your code. Once the issue is resolved for the local builds, we can then troubleshoot if it still occurs at Netlify. Currently, it happens even without Netlify so it isnโt something we can fix ourselves.
Note, our support team cannot debug your code but someone else on this support forum might. It is just that our support team doesnโt have the resources to troubleshoot code unless it is code that Netlify has written.This means that your question is still definitely welcome here but our scope of support does not include debugging the code you write. It might also help to ask about that error on a site which is specific to debugging Docusaurus.
Hi, @someengineer. I donโt know why the error was occurring. I know that Netlify wasnโt the cause but that is all I know.
This is how I saw the error:
Install Ubuntu 20.04 LTS on a system or VM
Install Node 18.14.0 on that system
Instal yarn 1.22.19 on that system
Install Git
Clone the repo and cd into the base directory
checkout the commit for the pull request
run yarn install
run yarn build
the error occurs
Now, you may have noticed me using the past-tense above (โwas occurringโ, โhow I sawโ, etc.). That is because when I test that above now, the build is successful locally.
So, whatever the error was, you appear to have fixed it now. I would recommend making a new deploy of the same commit as before (as I used the same commit as before and it worked for me).
In the deploy details, you can use this button to retry the same commit again:
Hi @luke, unfortunately itโs still broken. See here: Netlify App
The build succeeds when loading JSON files from GitHub (raw.githubusercontent.com) but fails when loading from DigitalOcean (cdn.some.engineering or somecdn.ams3.cdn.digitaloceanspaces.com).
It appears that you didnโt build the same commit again, but the same branch (the latest commit at the time of your reply was fetching the JSON from GitHub to illustrate the nature of the build failure, but I have since reverted the unwanted changes).
Other than changing the location of the JSON file, there were no other changes. Again, I think itโs a Netlify networking/proxy issue, as Iโm able to build successfully in my local environment with the DigitalOcean CDN endpoints.
P.S.- Really appreciate your time/help in troubleshoot this!
Since the Netlify build env seems to be unable to access resources from our CDN on DigitalOcean, Iโm going to add a workaround and have GitHub commit these data files so that we can publish these changes.
However, this is less than ideal as we will now be maintaining two copies of the data (one copy on GitHub and another in DigitalOcean). If this Netlify issue can still be resolved, itโd be greatly appreciated.
Hi, @someengineer. There is a false assumption here:
I proved it was not a Netlify issue. You stating โthis Netlify issueโ is a false assumption. It isnโt us.
I demonstrated the exact same error which occurred at Netlify also occurs when Netlify is not used in any way. This proves it is an issue on your side.
It is not Netlifyโs issue because, if it was, it would stop happening when Netlify was removed. Because it continues to happen when Netlify is not involved in any way, it proves Netlify is not to blame.
Did you think I ran the test from inside Netlifyโs networks? I did not. I tested from an independent network.
I ran your code on a system not controlled by Netlify, not running any Netlify code, and not on any network associated with or controlled by Netlify. However, I get the exact same error in that local VM. This proves, definitively, that the error is not caused by Netlify.
Finally, you deleted the commits/branch from the repo so I can no longer test the commits which did not work anymore. The repo change prevents me from testing the same commit as before so that option no longer exists.
Here is what I propose:
You tell me a commit that should work and does not at Netlify (a commit which still exists in the repo).
I will again test that independently of Netlify.
If it does not work independently of Netlify, then you debug your code and third-party site configurations until it does work.
Once it works for my local test, only then will we move on to troubleshooting it at Netlify.
Does that sound like an acceptable plan? If not, what do you propose as an alternative?