Hello community,
I’m using the CLI version 2.16.0 to upload a library I created, but it always ends with Network error from https://api.particle.io/v1/libraries. So I also tried publishing too but the same thing happens. Here’s a screenshot of the verbose output:
Environment:
- Operating System: macOS Big Sur version 11.6.
- CPU Architecture: M1 (Arm-based).
- Particle CLI Version: 2.16.0.
- Contents of my particle directory:
particle.config.json, profile.json.
- How was the Particle CLI installed: (advanced) using
npm install particle-cli -g.
- What terminal / shell are you running the Particle CLI within:
zsh.
Hi @abdullahmahboob ,
Thank you for writing in.
These issues are almost always caused by restrictive network policies - e.g. user is trying to do something (access network resources, etc) that their corporate firewall does not allow.
1 workaround is to add the particle.io domain to your allow list. Please try and let us know/
Hi there!
I’m having the same error message, but only when calling particle upload from a GitHub workflow.
Here is the output:
+ particle library upload -v
Network error from https://api.particle.io/v1/libraries
Error: Network error from https://api.particle.io/v1/libraries
at /usr/local/lib/node_modules/particle-cli/node_modules/particle-api-js/lib/Agent.js:246:19
at Request.callback (/usr/local/lib/node_modules/particle-cli/node_modules/superagent/lib/node/index.js:893:3)
at ClientRequest.<anonymous> (/usr/local/lib/node_modules/particle-cli/node_modules/superagent/lib/node/index.js:810:12)
at ClientRequest.emit (node:events:525:35)
at TLSSocket.socketErrorListener (node:_http_client:502:9)
at TLSSocket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
This is not a transient error: I received this error several times.
Running the exact same command with the same token on my machine works perfectly, so I suspect there could be a firewall rule on your side that (purposely or not) exclude GitHub-hosted runners (for example, musl.cc does this).
Best regards,
Benoit
The most common reason for a network error on upload is that the library is too large. When the size is exceeded, the cloud API disconnects the TLS client, which results in that error.
Make sure your Github Actions flow does not contain additional assets in the top level of the library directory that should not be uploaded as part of the library.
There shouldn’t be any firewall rules that would affect running from Actions.
Hi Rick,
Thank you very much for this prompt answer!
You mentioned the size as a likely cause in an older comment, so I double-checked this already.
If you look at the complete log, you’ll see that my script creates a temporary directory and copies the relevant files there, so as to be sure no extra file is included. Here is a simplified version of this script:
WORKDIR=$(mktemp -d)
cp README.md $WORKDIR/README.md
cp CHANGELOG.md $WORKDIR/CHANGELOG.md
cp library.properties $WORKDIR/library.properties
cp LICENSE.txt $WORKDIR/LICENSE.txt
cp -r src $WORKDIR/
cp -r examples $WORKDIR/
cd $WORKDIR
particle library upload -v
Also, the GitHub workflow works with a fresh clone of the repo, so even if I didn’t implement this temporary folder trick, the upload could not be more than 480KB (or 1.6MB uncompressed).
Lastly, when running the exact same commands on my machine, I get the following output:
+ particle library upload -v
Validating library at /tmp/tmp.MTm6SXdZS3/
Uploading library ArduinoJson
> Library ArduinoJson was successfully uploaded.
As you can see, it says “Validating library at $WORKDIR” before uploading.
This line is absent in the GitHub job’s log.
In summary, I really doubt that size is an issue here.
Any other ideas?
Best regards,
Benoit
My GitHub workflow passed today without any change from my side:
+ particle library upload -v
> Library ArduinoJson was successfully uploaded.
Add it to your project with particle library add ArduinoJson
+ particle library publish -v
> Library ArduinoJson was successfully published.
You guys must have fixed something, so thank you very much 