js-libp2p
js-libp2p copied to clipboard
AggregateError reporting in Firefox could be better
- Version: current HEAD
- Platform: Firefox on Linux
- Subsystem: dialer
Type: Enhancement
Severity: Very Low
Description:
The error reporting in Firefox is worse than in Chromium. Here's an example error message from Firefox:
Uncaught (in promise) AggregateError:
dial@http://localhost:8765/demo/main.js:135097:21
dialAction@http://localhost:8765/demo/main.js:129589:36
./node_modules/libp2p/src/dialer/dial-request.js/run/<@http://localhost:8765/demo/main.js:129374:29
Async*run@http://localhost:8765/demo/main.js:129369:36
_createPendingDial@http://localhost:8765/demo/main.js:129607:28
connectToPeer@http://localhost:8765/demo/main.js:129522:71
async*dialProtocol@http://localhost:8765/demo/main.js:130673:38
dial@http://localhost:8765/demo/main.js:130648:17
connect@http://localhost:8765/demo/main.js:77769:18
async*./node_modules/ipfs-core-utils/src/with-timeout-option.js/withTimeoutOption/<@http://localhost:8765/demo/main.js:66356:46
onLoad@http://localhost:8765/demo/main.js:195381:20
async*@http://localhost:8765/demo/main.js:195437:8
@http://localhost:8765/demo/main.js:195439:3
@http://localhost:8765/demo/main.js:195441:12
dial@http://localhost:8765/demo/main.js:135097:21
dialAction@http://localhost:8765/demo/main.js:129589:36
./node_modules/libp2p/src/dialer/dial-request.js/run/<@http://localhost:8765/demo/main.js:129374:29
Async*run@http://localhost:8765/demo/main.js:129369:36
_createPendingDial@http://localhost:8765/demo/main.js:129607:28
connectToPeer@http://localhost:8765/demo/main.js:129522:71
async*dialProtocol@http://localhost:8765/demo/main.js:130673:38
dial@http://localhost:8765/demo/main.js:130648:17
connect@http://localhost:8765/demo/main.js:77769:18
async*./node_modules/ipfs-core-utils/src/with-timeout-option.js/withTimeoutOption/<@http://localhost:8765/demo/main.js:66356:46
onLoad@http://localhost:8765/demo/main.js:195381:20
async*@http://localhost:8765/demo/main.js:195437:8
@http://localhost:8765/demo/main.js:195439:3
@http://localhost:8765/demo/main.js:195441:12
dial@http://localhost:8765/demo/main.js:135097:21
dialAction@http://localhost:8765/demo/main.js:129589:36
./node_modules/libp2p/src/dialer/dial-request.js/run/<@http://localhost:8765/demo/main.js:129374:29
Async*run@http://localhost:8765/demo/main.js:129369:36
_createPendingDial@http://localhost:8765/demo/main.js:129607:28
connectToPeer@http://localhost:8765/demo/main.js:129522:71
async*dialProtocol@http://localhost:8765/demo/main.js:130673:38
dial@http://localhost:8765/demo/main.js:130648:17
connect@http://localhost:8765/demo/main.js:77769:18
async*./node_modules/ipfs-core-utils/src/with-timeout-option.js/withTimeoutOption/<@http://localhost:8765/demo/main.js:66356:46
onLoad@http://localhost:8765/demo/main.js:195381:20
async*@http://localhost:8765/demo/main.js:195437:8
@http://localhost:8765/demo/main.js:195439:3
@http://localhost:8765/demo/main.js:195441:12
AggregateError index.js:33
maybeSettle index.js:31
pSome index.js:69
pSome index.js:73
_promise index.js:61
PCancelable index.js:31
pSome index.js:7
exports index.js:6
run dial-request.js:65
_createPendingDial index.js:200
connectToPeer index.js:115
dialProtocol index.js:455
dial index.js:430
connect connect.js:19
withTimeoutOption with-timeout-option.js:20
onLoad index.js:58
async* index.js:114
<anonymous> main.js:195439
<anonymous> main.js:195441
index.js:33
onLoad index.js:93
InterpretGeneratorResume self-hosted:1475
AsyncFunctionThrow self-hosted:679
(Async: async)
<anonymous> index.js:114
<anonymous> main.js:195439
<anonymous> main.js:195441
It is hard to tell what the problem is. Though in Chromium the error message is better:
index.js:33 Uncaught (in promise) AggregateError:
Error: No transport available for address /ip4/127.0.0.1/tcp/15003/ws/p2p/12D3KooWPmPb9UBSNuJwoCPU8X7qz4CqT5BxAu1JawxZFUW8FTc9
at TransportManager.dial (http://localhost:8765/demo/main.js:135097:21)
at DialRequest.dialAction (http://localhost:8765/demo/main.js:129589:36)
at http://localhost:8765/demo/main.js:129374:29
at async http://localhost:8765/demo/main.js:173151:19
at maybeSettle (http://localhost:8765/demo/main.js:173129:11)
at http://localhost:8765/demo/main.js:173167:23
AggregateError @ index.js:33
maybeSettle @ index.js:31
(anonymous) @ index.js:69
async function (async)
onLoad @ index.js:49
load (async)
(anonymous) @ index.js:114
(anonymous) @ index.js:114
(anonymous) @ index.js:114
There on the second line, it is clear that the issue has something to do with the transport.
Steps to reproduce the error:
I ran some code in the Browser to play with relays. I installed https://github.com/libp2p/js-libp2p-relay-server and wanted to connect to is. I was missing the
transport: {
[transportKey]: {
filter: filters.all
}
}
as documented here.
I did run a local checkout of js-libp2p-relay-server via node ./src/bin.js --peerId id.json and then tried to connect to it via await node.swarm.connect('/ip4/127.0.0.1/tcp/15003/ws/p2p/12D3KooWPmPb9UBSNuJwoCPU8X7qz4CqT5BxAu1JawxZFUW8FTc9')
Please note that the node is a full IPFS node (and not a libp2p node), the config I was using was:
const nodeInit = IPFS.create({
repo: '/tmp/chatapp',
libp2p: {
config: {
dht: {
enabled: true
},
pubsub: {
enabled: true
},
//transport: {
// // This is added for local demo!
// // In a production environment the default filter should be used
// // where only DNS + WSS addresses will be dialed by websockets in the browser.
// [transportKey]: {
// filter: filters.all
// }
//}
}
},
relay: {
enabled: true, // enable relay dialer/listener (STOP)
hop: {
enabled: true // make this node a relay (HOP)
}
},
config: {
Bootstrap: []
}
})
const node = await nodeInit