hardhat
hardhat copied to clipboard
Hardhat 2.11 fails in docker environments
Reproduction: https://github.com/DefiCake/hardhat-211-docker-bug-report
I am finding troubles when running hardhat inside CI pipelines. I am not sure where this was introduced, suspecting the latest 2.11 where compile time optimizations happened, but not really sure. Got a personal project at v.2.9.9 where it does work well.
It boils down to it failing when running in dockerized envs with either one of these two errors:
Either it will exit early during solc download and not run the test:
test_1 | yarn run v1.22.19
test_1 | $ hardhat test
test_1 | Downloading compiler 0.8.17
test_1 | Done in 1.19s.
hardhat-211-compiler-bug_test_1 exited with code 0
Or it will fail with an EPIPE error:
test_1 | yarn run v1.22.19
test_1 | $ hardhat test
test_1 | Error: write EPIPE
test_1 | at afterWriteDispatched (internal/stream_base_commons.js:156:25)
test_1 | at writeGeneric (internal/stream_base_commons.js:147:3)
test_1 | at Socket._writeGeneric (net.js:798:11)
test_1 | at Socket._write (net.js:810:8)
test_1 | at writeOrBuffer (internal/streams/writable.js:358:12)
test_1 | at Socket.Writable.write (internal/streams/writable.js:303:10)
test_1 | at output (/app/node_modules/hardhat/src/internal/solidity/compiler/index.ts:82:24)
test_1 | at new Promise (<anonymous>)
test_1 | at NativeCompiler.compile (/app/node_modules/hardhat/src/internal/solidity/compiler/index.ts:66:34)
test_1 | at SimpleTaskDefinition.action (/app/node_modules/hardhat/src/builtin-tasks/compile.ts:639:37)
test_1 | error Command failed with exit code 1.
test_1 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
hardhat-211-compiler-bug_test_1 exited with code 1
Docker info: Docker version 20.10.18, build b40c2f6 docker-compose version 1.29.2, build 5becea4c
Might be related to https://github.com/NomicFoundation/hardhat/issues/3188
This issue is also being tracked on Linear.
We use Linear to manage our development process, but we keep the conversations on Github.
LINEAR-ID: fa612b95-5d81-47ef-b1ea-2a58808c9f9b
Update: using an x86_64 docker image seems to do the trick. I was using node-alpine. Switching to a non-alpine version made it work.
the problem is in the alpine image, it missing ld-linux-x86-64.so.2 library, so solc compilers won't run
We are also experiencing a similar problem. We recently updated some dependencies (including hardhat
) and everything works fine locally - until we hit our CI / CD pipeline which uses docker containers under the hood.
We are also experiencing a similar problem. We recently updated some dependencies (including
hardhat
) and everything works fine locally - until we hit our CI / CD pipeline which uses docker containers under the hood.
yes, before all worked well somehow.. strange, because solc compilers isn't part of hardhat.
We solved the problem by using an node:lts-slim
for our frontend instead of alpine
.
Ran into this exact same issue. Took me a few hours to figure out my docker image was missing the ld-linux-x86-64.so.2
lib.
For me just adding RUN apk --no-cache add libc6-compat
did the trick.
Ran into this exact same issue. Took me a few hours to figure out my docker image was missing the
ld-linux-x86-64.so.2
lib. For me just addingRUN apk --no-cache add libc6-compat
did the trick.
It works :+1:
Thanks everyone, this helped me find an extremely weird bug in Hardhat and made me realize I had a big hole in my mental model of how node works. Fun stuff.
We'll include a fix for this in our next release.
Fixed in [email protected].