Truffle: EPROTO error on Truffle Init

Created on 16 Apr 2020  ·  15Comments  ·  Source: trufflesuite/truffle

  • [x] I've asked for help in the Truffle Gitter before filing this issue.

    alot...

Issue

Problem seems to be with SSL and NPM? I've had this happen on both my VM & Win10 Pro
Truffle is having a download error when downloading projects or initializing.
I tried to ask on stack exchange and it got deleted..... So I'm just trying to get stuff working. This is my first issue report so bare with me.

Steps to Reproduce

simply typing "truffle init" or building any of the packages.

Expected Behavior

I expected it to build.

Actual Results

Windows 10 Pro:
`DownloadingError: write EPROTO 15960:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)


Ubuntu VM:
sboxes@osboxes:~/int/pet-shop-tutorial$ truffle unbox pet-shop
Starting unbox...
✔ Preparing to download box
⠏ DownloadingError: write EPROTO 140397100076032:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:

at WriteWrap.afterWrite (net.js:782:14)

Environment

  • Operating System: Windows 10 Pro (1809) / Ubuntu 19.10
  • Ethereum client: 1.9.12
  • Truffle version (truffle version): V5.1.21
  • node version (node --version): v13.13.0
  • npm version (npm --version): 6.14.4
bug needs investigated priority2 ⚠️

Most helpful comment

tl;dr: A Github subdomain's SSL for downloading the Truffle boxes from Github repos as ZIPs is broke (my guess it it's trying to do a redirect improperly).

Workaround: Simply run,

git clone https://github.com/trufflesuite/truffle-init-default

to get the default init box. You can then delete the .git folder if you so wish to start from scratch.


Was also running to the same issue. I did some investigation and managed to find the root cause.

Here is the chain of events:

  1. Running the truffle init command uses the @truffle/box package in packages/box/
  2. To download the Truffle "box", it tries to download another GitHub repo (by default it's trufflesuite/truffle-init-default).
    Specifically, @truffle/box in packages/box/lib/utils/unbox.ts:L42 calls into the github-download npm package to download the repo.
  3. The github-download package, to download the ZIP, [code ref] actually uses an external website at https://nodeload.github.com/ which is causing the SSL errors (my guess is an improper redirect).

You should be able to reproduce the same SSL error if you try opening the nodeload.github.com domain from curl (or get an SSL error if you try to open it in your browser).

$ curl https://nodeload.github.com/                                                                                                                
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

You can see that this is the same exact error you get from Truffle, as shown below.

$ npx truffle init
- Fetching solc version list from solc-bin. Attempt #1

Starting unbox...
=================

✔ Preparing to download box
⠇ DownloadingError: write EPROTO 139648867133312:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:331:

    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)

Ideally, the fix would be submitting a PR to the github-dowload package to change the download URL to instead use the official Github ZIP download URL. Then, Truffle as well as any dependant packages are not broken. (edit: just submitted a PR)

So I guess it really is "turtles all the way down"...

All 15 comments

Huh. This looks new. Truffle downloads boxes from github, you might find some luck digging into your proxy settings or your git config?

Also, maybe try Node v10. I imagine Node v13 might have issues with Truffle.

Thanks for raising this issue! I hope you can find a workaround until someone can figure out a proper fix here.

Hm your link @WarKitteh is "unknown protocol" error, but your error looks like "wrong version number". I would guess that those errors might be different? Not sure.

PS \New folder> nvm use 10
10.0.0
Now using node v10.0.0 (64-bit)
PS \New folder> truffle init

Starting unbox...
=================

√ Preparing to download box
\ DownloadingError: write EPROTO 8600:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:

    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)

I tried it on my MacBook and here's what I got.

-MacBook-Air:New folder Souza$ truffle init
This directory is non-empty...
? Proceed anyway? (Y/n) 
Starting unbox...
=================

? Proceed anyway? Yes
✔ Preparing to download box
⠼ DownloadingError: Client network socket disconnected before secure TLS connection was established
    at connResetException (internal/errors.js:613:14)
    at TLSSocket.onConnectEnd (_tls_wrap.js:1532:19)
    at Object.onceWrapper (events.js:421:28)
    at TLSSocket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
-MacBook-Air:New folder Souza$ node -v
v13.12.0
-MacBook-Air:New folder Souza$ npm -v
6.14.4
-MacBook-Air:New folder Souza$ geth -v
Incorrect Usage. flag provided but not defined: -v

NAME:
   geth - the go-ethereum command line interface

   Copyright 2013-2019 The go-ethereum Authors

USAGE:
   geth [options] command [command options] [arguments...]

VERSION:
   1.9.12-stable

Looks like it worked once when I turned off my VPN but if I tried the pet shop or init again I get the old ssl error

-MacBook-Air:petshop Souza$ truffle unbox pet-shop

Starting unbox...
=================

✔ Preparing to download box
⠋ DownloadingError: write EPROTO 4333768128:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)

We're looking into this, please stay tuned! Sorry about the inconvenience!

Well this seems to be an issue of my network... I’m not sure what’s causing the issue but when I open a hotspot everything works out. I will try to post a packet capture soon.

Ok, let us know what you discover @WarKitteh.

I have had the same issue on my Windows machine. truffle unbox will not work. Also now having issues when I try to migrate it shows that they compiled successfully and then it just ends terminates silently.

have the same issue while trying to unbox

Preparing to download box
⠧ DownloadingError: write EPROTO 4556295616:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)

I'm experiencing the same issue on WSL Ubuntu 18.04 LTS, truffle version 5.1.28.

Seeing a different file from the others though:

DownloadingError: write EPROTO 140198787221312:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

    at WriteWrap.afterWrite (net.js:789:14)

had the same problem, fixed it by changing wifi networks. would like to know the root cause though

tl;dr: A Github subdomain's SSL for downloading the Truffle boxes from Github repos as ZIPs is broke (my guess it it's trying to do a redirect improperly).

Workaround: Simply run,

git clone https://github.com/trufflesuite/truffle-init-default

to get the default init box. You can then delete the .git folder if you so wish to start from scratch.


Was also running to the same issue. I did some investigation and managed to find the root cause.

Here is the chain of events:

  1. Running the truffle init command uses the @truffle/box package in packages/box/
  2. To download the Truffle "box", it tries to download another GitHub repo (by default it's trufflesuite/truffle-init-default).
    Specifically, @truffle/box in packages/box/lib/utils/unbox.ts:L42 calls into the github-download npm package to download the repo.
  3. The github-download package, to download the ZIP, [code ref] actually uses an external website at https://nodeload.github.com/ which is causing the SSL errors (my guess is an improper redirect).

You should be able to reproduce the same SSL error if you try opening the nodeload.github.com domain from curl (or get an SSL error if you try to open it in your browser).

$ curl https://nodeload.github.com/                                                                                                                
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

You can see that this is the same exact error you get from Truffle, as shown below.

$ npx truffle init
- Fetching solc version list from solc-bin. Attempt #1

Starting unbox...
=================

✔ Preparing to download box
⠇ DownloadingError: write EPROTO 139648867133312:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:331:

    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)

Ideally, the fix would be submitting a PR to the github-dowload package to change the download URL to instead use the official Github ZIP download URL. Then, Truffle as well as any dependant packages are not broken. (edit: just submitted a PR)

So I guess it really is "turtles all the way down"...

@jaxrtech Cool, thanks for doing all the investigation! This problem has been popping up occasionally. I'm not sure that github download library is well-maintained and so I have a PR to use another library here. I'll try and get the tests passing and hopefully these problems will resolve themselves.

Was this page helpful?
0 / 5 - 0 ratings