Help!
I am trying to address a build issue in regards to the NPM package - node-libcurl - https://www.npmjs.com/package/node-libcurl
The logs below show that I am not able to build the package. I’m assuming I need to install openssl to my site.
Can anyone recommend the safest implementation of openssl into a Netlify site. Any feedback is greatly appreciated. Thanks.
4:24:24 PM: Failed to compile.
4:24:24 PM:
4:24:24 PM: ./node_modules/node-libcurl/lib/binding/node_libcurl.node 1:0
4:24:24 PM: Module parse failed: Unexpected character '' (1:0)
4:24:24 PM: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
4:24:24 PM: (Source code omitted for this binary file)
4:24:24 PM: > Build error occurred
4:24:24 PM: Error: > Build failed because of webpack errors
4:24:24 PM: at /opt/build/repo/node_modules/next/dist/build/index.js:15:918
4:24:24 PM: at async /opt/build/repo/node_modules/next/dist/build/tracer.js:1:525
luke
February 2, 2021, 8:20am
2
Hi, @9ntonio . I’m reading that error differently that you are.
To me the error is saying that the was a failure for webpack to compile its bundles based on a parsing error and that the error has nothing to do with a package install.
Would you please post a link to the site build logs (or post the full log output here)?
@luke thanks for your feedback. Here is the log you requested. It’s too large for this pot so I’m including a link: https://app.netlify.com/teams/9ntonio/builds/6018983abb93a20008dcb8f0
I noted openssl as I had the same error on my local machine until I added openssl via brew.
Please let me know if you need anything else.
Antonio
luke
February 3, 2021, 1:20am
4
Hi, @9ntonio . I see the curl
dependency install failing in those logs:
4:22:16 PM: ==> Installing curl dependency: openssl@1.1
4:22:16 PM: ==> perl Makefile.PL INSTALL_BASE=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec
4:22:16 PM: ==> make PERL5LIB=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec/lib/perl5 CC=gcc-5
4:22:16 PM: ==> make install
4:22:16 PM: ==> perl Makefile.PL INSTALL_BASE=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec
4:22:16 PM: ==> make PERL5LIB=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec/lib/perl5 CC=gcc-5
4:22:16 PM: ==> make install
4:22:16 PM: ==> perl Makefile.PL INSTALL_BASE=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec
4:22:16 PM: ==> make PERL5LIB=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec/lib/perl5 CC=gcc-5
4:22:16 PM: ==> make install
4:22:16 PM: ==> perl ./Configure --prefix=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i --openssldir=/opt/buildhome/.linuxbrew/etc/openssl@1.1 no-ssl3 no-ssl3-method no-zlib enable-md2 linux-x86_64
4:22:16 PM: ==> make
4:22:16 PM: ==> make install MANDIR=/opt/buildhome/.linuxbrew/Cellar/openssl@1.1/1.1.1i/share/man MANSUFFIX=ssl
4:22:16 PM: ==> make test
4:22:16 PM: Last 15 lines from /opt/buildhome/.cache/Homebrew/Logs/openssl@1.1/13.make:
4:22:16 PM: ../test/recipes/99-test_ecstress.t ................. ok
4:22:16 PM: ../test/recipes/99-test_fuzz.t ..................... ok
4:22:16 PM: Test Summary Report
4:22:16 PM: -------------------
4:22:16 PM: ../test/recipes/30-test_afalg.t (Wstat: 256 Tests: 1 Failed: 1)
4:22:16 PM: Failed test: 1
4:22:16 PM: Non-zero exit status: 1
4:22:16 PM: Files=158, Tests=2635, 138 wallclock secs ( 2.12 usr 0.27 sys + 100.45 cusr 32.58 csys = 135.42 CPU)
4:22:16 PM: Result: FAIL
4:22:16 PM: Makefile:207: recipe for target '_tests' failed
4:22:16 PM: make[1]: *** [_tests] Error 1
4:22:16 PM: make[1]: Leaving directory '/tmp/openssl-1.1-20210202-18131-13cocy8/openssl-1.1.1i'
4:22:16 PM: Makefile:205: recipe for target 'tests' failed
4:22:16 PM: make: *** [tests] Error 2
4:22:16 PM: READ THIS: https://docs.brew.sh/Troubleshooting
4:22:16 PM: These open issues may also help:
4:22:16 PM: Cannot update openssl@1.1 because their test fails https://github.com/Homebrew/linuxbrew-core/issues/22015
4:22:16 PM: Installing curl has failed!
4:22:16 PM: Homebrew Bundle failed! 1 Brewfile dependency failed to install.
The logs above include this link to the open issue:
opened 06:05PM - 03 Jan 21 UTC
closed 10:58AM - 17 Aug 21 UTC
# Bug report
**Please note we will close your issue without comment if you de… lete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.**
- [x] ran `brew update` and can still reproduce the problem?
- [x] ran `brew doctor`, fixed all issues and can still reproduce the problem?
- [x] ran `brew gist-logs <formula>` (where `<formula>` is the name of the formula that failed) and included the output link?
- [x] if `brew gist-logs` didn't work: ran `brew config` and `brew doctor` and included their output with your issue?
## What you were trying to do (and why)
Update any formula which has a dependency on `openssl@1.1`, or just `brew upgrade openssl@1.1`. OpenSSL must be updated to the latest `1.1.1i`
## What happened (include command output)
An error occurred while executing `make test` here:
https://github.com/Homebrew/linuxbrew-core/blob/fd44ef07c79376048fe620765464fa4f6ae7ec72/Formula/openssl%401.1.rb#L108
https://gist.github.com/StudioMaX/34880cfff7c683e6d865268e3f7cde3b
At first I thought it had something to do with my Ubuntu 16.04 and some sort of bug with tests in OpenSSL, so I created this bug in upstream: https://github.com/openssl/openssl/issues/13758. Please read this first.
After some research I found that during the `make test` a new compiled `./apps/openssl` binary is executed, but it loads additional shared libraries `libssl.so.1.1` and `libcrypto.so.1.1` from the previously installed OpenSSL `1.1.1g`, although it should find new libraries in the root directory where OpenSSL was compiled.
```
linuxbrew@host:~/tmp/openssl-1.1.1i$ ./apps/openssl version
OpenSSL 1.1.1i 8 Dec 2020 (Library: OpenSSL 1.1.1g 21 Apr 2020)
linuxbrew@host:~/tmp/openssl-1.1.1i$ ldd ./apps/openssl
linux-vdso.so.1 => (0x00007fff9d19c000)
libssl.so.1.1 => /usr/home/linuxbrew/.linuxbrew/lib/libssl.so.1.1 (0x00007fe89b814000)
libcrypto.so.1.1 => /usr/home/linuxbrew/.linuxbrew/lib/libcrypto.so.1.1 (0x00007fe89b3bd000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe89b1b9000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe89af9c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe89abd2000)
/usr/home/linuxbrew/.linuxbrew/lib/ld.so => /lib64/ld-linux-x86-64.so.2 (0x00007fe89b680000)
```
When running tests, OpenSSL uses an additional wrapper `./util/shlib_wrap.sh ./apps/openssl ...`, whose task is to [add LD_LIBRARY_PATH](https://github.com/openssl/openssl/blob/90cebd1b216e0a160fcfd8e0eddca47dad47c183/util/shlib_wrap.sh.in#L99-L111) before executing `./apps/openssl`, in order to first find libraries `libssl.so.1.1` and `libcrypto.so.1.1` in the openssl build directory.
But adding this environment variable does not work, since brewed gcc [adds `RPATH`](https://github.com/openssl/openssl/issues/13758#issuecomment-753641486) to the dynamic section of the binary, which points to `/usr/home/linuxbrew/.linuxbrew/lib`.
Since `RPATH` has a higher priority than `LD_LIBRARY_PATH`, the necessary libraries are first searched for in directory `/usr/home/linuxbrew/.linuxbrew/lib`, although they should be loaded from `/tmp/openssl-1.1-20210103-20036-1xvc65/openssl-1.1.1i`.
<details>
<summary>Command output</summary>
<pre>
```
linuxbrew@host:~/tmp/openssl-1.1.1i$ brew upgrade openssl@1.1
==> Upgrading 1 outdated package:
openssl@1.1 1.1.1g -> 1.1.1i
==> Upgrading openssl@1.1 1.1.1g -> 1.1.1i
Warning: Building openssl@1.1 from source as the bottle needs:
- HOMEBREW_CELLAR: /home/linuxbrew/.linuxbrew/Cellar (yours is /usr/home/linuxbrew/.linuxbrew/Cellar)
- HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew (yours is /usr/home/linuxbrew/.linuxbrew)
- HOMEBREW_REPOSITORY: /home/linuxbrew/.linuxbrew/Homebrew (yours is /usr/home/linuxbrew/.linuxbrew/Homebrew)
==> Downloading https://curl.haxx.se/ca/cacert-2020-01-01.pem
Already downloaded: /usr/home/linuxbrew/.cache/Homebrew/downloads/e2b36a2c425753a7b9d6a8eccb44b33cb7ed93cb91f96dafcf35fa18d8e0513a--cacert-2020-01-01.pem
==> Downloading https://cpan.metacpan.org/authors/id/L/LE/LEONT/Test-Harness-3.42.tar.gz
Already downloaded: /usr/home/linuxbrew/.cache/Homebrew/downloads/4a5728e2132a470084886ad6e6278c6b23584e314ee60dcd57ea679202d5da4a--Test-Harness-3.42.tar.gz
==> Downloading https://cpan.metacpan.org/authors/id/E/EX/EXODIST/Test-Simple-1.302175.tar.gz
Already downloaded: /usr/home/linuxbrew/.cache/Homebrew/downloads/af880136321fd9982d8eb9dd29977fec40c093fb2fd48d6fff85de8d6bb9a5b5--Test-Simple-1.302175.tar.gz
==> Downloading https://cpan.metacpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.48.tar.gz
Already downloaded: /usr/home/linuxbrew/.cache/Homebrew/downloads/5c7e196d2435858f251597e37b63b670add424924b9e99d3079665b0628eed04--ExtUtils-MakeMaker-7.48.tar.gz
==> Downloading https://www.openssl.org/source/openssl-1.1.1i.tar.gz
Already downloaded: /usr/home/linuxbrew/.cache/Homebrew/downloads/fd23ba7b701c9f6232538758ea8cc3025119733e0e3e6f6af55517e8bdc49b0e--openssl-1.1.1i.tar.gz
==> perl Makefile.PL INSTALL_BASE=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec
==> make PERL5LIB=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec/lib/perl5 CC=gcc-5
==> make install
==> perl Makefile.PL INSTALL_BASE=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec
==> make PERL5LIB=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec/lib/perl5 CC=gcc-5
==> make install
==> perl Makefile.PL INSTALL_BASE=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec
==> make PERL5LIB=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i/libexec/lib/perl5 CC=gcc-5
==> make install
==> perl ./Configure --prefix=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i --openssldir=/usr/home/linuxbrew/.linuxbrew/etc/openssl@1.1 no-ssl3 no-ssl3-method no-zlib enable-md2
==> make
==> make install MANDIR=/usr/home/linuxbrew/.linuxbrew/Cellar/openssl@1.1/1.1.1i/share/man MANSUFFIX=ssl
==> make test
Last 15 lines from /usr/home/linuxbrew/.cache/Homebrew/Logs/openssl@1.1/13.make:
Failed tests: 111-112, 144
Non-zero exit status: 3
../test/recipes/90-test_sslapi.t (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
../test/recipes/90-test_v3name.t (Wstat: 256 Tests: 1 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=158, Tests=2634, 134 wallclock secs ( 2.51 usr 0.27 sys + 108.37 cusr 10.72 csys = 121.87 CPU)
Result: FAIL
Makefile:207: recipe for target '_tests' failed
make[1]: *** [_tests] Error 1
make[1]: Leaving directory '/tmp/openssl-1.1-20210103-20036-1xvc65/openssl-1.1.1i'
Makefile:205: recipe for target 'tests' failed
make: *** [tests] Error 2
READ THIS: https://docs.brew.sh/Troubleshooting
```
</pre>
</details>
## What you expected to happen
OpenSSL must be updated from `1.1.1g` to `1.1.1i` successfully.
I'm not sure exactly, but most likely `RPATH` shouldn't be added to the binary.
## Step-by-step reproduction instructions (by running `brew install` commands)
1. Have previously installed `openssl@1.1` with version 1.1.1g.
2. Update to the new openssl version 1.1.1i via `brew upgrade openssl@1.1`
So, yes, there is a bug in the Homebrew install of this package.
Thanks @luke for your help on this, I appreciate the feedback. Knowing that the build is failing via brew, can you recommend another way of installing openssl in my build?
Thanks.
luke
February 3, 2021, 7:11am
6
Hi, @9ntonio . I have no idea. I’d be happy to learn about this with you but I’ll need more information to answer.
First, curl
and openssl
should already be available in our build image so I don’t understand why these Homebrew packages are being used in the first place. Also, most site using node to build will be using npm
or yarn
to manage their dependencies so, again, this use of Homebrew is puzzling to me.
Have you tried removing the Homebrew dependency and using the npm
package instead?
client url library, high level request functions. Latest version: 0.1.4, last published: 12 years ago. Start using curl in your project by running `npm i curl`. There are 70 other projects in the npm registry using curl.
@luke thanks for the info on your build images. I wasn’t aware that both packages were already installed. On my end I am using this node package - https://www.npmjs.com/package/node-libcurl which allows me to create curl calls using js promises. I will try to remove the brew package install and see if the node package errors out or builds. Either way I will post my findings. Thanks.
1 Like
9ntonio
February 17, 2021, 1:31am
8
@luke I was able to resolve my issue via the addition of the next.config.js
file. I removed any Homebrew installs and I was still getting webpack loader errors. I needed to let webpack load .node
file types. I did this with the next.config.js
file and the following code within it.
module.exports = {
target: 'experimental-serverless-trace',
// !! 'node-libcurl' needs to be able to access '.node' files.
// !! 'node-loader' is used as the loader via this webpack config.
webpack(config, options) {
config.module.rules.push({
test: /\.node$/,
loader: 'node-loader',
});
return config;
}
};
I also needed to install the node-loader
npm package to help resolve the issue. Note the loader type above node-loader
. LMK if you have any questions.