Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading from 0.0.16 to 0.0.18 breaks build #1564

Closed
Tracked by #1455
agazso opened this issue Sep 12, 2023 · 4 comments
Closed
Tracked by #1455

Upgrading from 0.0.16 to 0.0.18 breaks build #1564

agazso opened this issue Sep 12, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@agazso
Copy link

agazso commented Sep 12, 2023

This is a bug report

Problem

I have an application that uses @waku/sdk. I tried upgrading the version of @waku/sdk from 0.0.16 to 0.0.18 and changed nothing else and now my build is failing (see the error output at the end).

It looks like a polyfill issue again coming from libp2p.

Notes

@waku/sdk version 0.0.18 (the latest working that I tried was 0.0.16)
Node.js v18.17.1 on Linux

Error output when building:

vite v4.3.9 building for production...
transforming (696) node_modules/.pnpm/[email protected]/node_modules/uint8arrays/dist/src/from-string.js[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/ping/index.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
transforming (774) node_modules/.pnpm/@[email protected]/node_modules/@waku/proto/dist/index.js[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/identify/identify.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
transforming (831) node_modules/.pnpm/@[email protected]/node_modules/@multiformats/mafmt/dist/src/index.js[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/libp2p.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
transforming (878) node_modules/.pnpm/@[email protected]/node_modules/@chainsafe/libp2p-gossipsub/dist/src/message/decodeRpc.js[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/upgrader.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
transforming (1001) node_modules/.pnpm/@[email protected]/node_modules/@chainsafe/libp2p-noise/dist/src/handshakes/xx.js[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/dial-queue.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
transforming (1122) node_modules/.pnpm/@[email protected]/node_modules/@noble/hashes/esm/_u64.js[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
transforming (1382) src/lib/objects/external/lib.tsnode_modules/.pnpm/@[email protected]/node_modules/@protobufjs/inquire/index.js (12:18) Use of eval in "node_modules/.pnpm/@[email protected]/node_modules/@protobufjs/inquire/index.js" is strongly discouraged as it poses security risks and may cause issues with minification.
✓ 1384 modules transformed.
✓ built in 5.87s
"setMaxListeners" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.js".
file: /home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.js:1:9
1: import { setMaxListeners } from 'events';
            ^
2: import { logger } from '@libp2p/logger';
3: import { multiaddr } from '@multiformats/multiaddr';
[vite-plugin-sveltekit-compile] "setMaxListeners" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.js".
file: /home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.js:1:9
1: import { setMaxListeners } from 'events';
            ^
2: import { logger } from '@libp2p/logger';
3: import { multiaddr } from '@multiformats/multiaddr';
✓ built in 9.53s
error during build:
RollupError: "setMaxListeners" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/[email protected]/node_modules/libp2p/dist/src/connection-manager/utils.js".
    at error (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
    at Module.error (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:13604:16)
    at Module.traceVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:14029:29)
    at ModuleScope.findVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:12547:39)
    at FunctionScope.findVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
    at ChildScope.findVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
    at BlockScope.findVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
    at BlockScope.findVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
    at TrackingScope.findVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
    at BlockScope.findVariable (file:///home/attila/Projects/LogosLab/waku-objects-playground/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
 ELIFECYCLE  Command failed with exit code 1.

@fryorcraken fryorcraken added this to Waku Sep 12, 2023
@weboko weboko moved this to Triage in Waku Sep 13, 2023
@weboko
Copy link
Collaborator

weboko commented Sep 13, 2023

@agazso, is it the same for @waku/sdk of 0.0.19?

@weboko weboko moved this from Triage to To Do in Waku Sep 13, 2023
@weboko weboko self-assigned this Sep 13, 2023
@agazso
Copy link
Author

agazso commented Sep 14, 2023

@agazso, is it the same for @waku/sdk of 0.0.19?

Yes, it is the same with version 0.0.19

@agazso
Copy link
Author

agazso commented Sep 14, 2023

I tried out and the first version which starts breaking is 0.0.17 of @waku/sdk. I see in that version there was a libp2p version upgrade which may explain this.

https://github.com/waku-org/js-waku/releases/tag/sdk-v0.0.17

@weboko weboko mentioned this issue Sep 14, 2023
24 tasks
@fryorcraken fryorcraken added the bug Something isn't working label Sep 22, 2023
@weboko weboko moved this from To Do to In Progress in Waku Sep 25, 2023
@weboko
Copy link
Collaborator

weboko commented Oct 2, 2023

Origination of the problem is the approach to how vite works. It's stance is that they do not include anything but browser-related dependencies and if anyone needs they should add polyfills themself.

Tried different ways to handle that on js-waku level of abstraction but couldn't find any.

So as per advice from Vite - making an issue on the side of libp2p to address it.

As mitigation following steps can be done:

Issue on libp2p side libp2p/js-libp2p#2110

@weboko weboko closed this as completed Oct 2, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Waku Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants