You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The onerror function defined in .stream checks if the received error is an instance of MessasgeEvent - this works fine in the browser but it will fail if you are running in node, since MessageEvent is not part of Node's API.
Expected behavior
If there is an error from the stream, then it should be handled by my onerror function, but instead we get
/js-stellar-canary/node_modules/stellar-sdk/lib/call_builder.js:75
if (options.onerror && error instanceof MessageEvent) {
^
ReferenceError: MessageEvent is not defined
at EventSource.es.onerror (/js-stellar-canary/node_modules/stellar-sdk/lib/call_builder.js:75:61)
at EventSource.emit (events.js:203:13)
at _emit (/js-stellar-canary/node_modules/eventsource/lib/eventsource.js:242:17)
at onConnectionClosed (/js-stellar-canary/node_modules/eventsource/lib/eventsource.js:52:5)
at IncomingMessage.<anonymous> (/js-stellar-canary/node_modules/eventsource/lib/eventsource.js:169:9)
at IncomingMessage.emit (events.js:208:15)
at endReadableNT (_stream_readable.js:1154:12)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
Additional context
This error was originally reported by @danieldeusing on keybase
The text was updated successfully, but these errors were encountered:
Using `MessageEvent` will throw an error if you are running the SDK on
Node (this API is not present in Node).
This was added in the TypeScript migration to match the expected
interface.
Checking the `error` instance shouldn't be a concern on the SDK but
the consumer, is up to the consumer what to do with an
error. Additionally we shouldn't be hiding errors just because they
don't match a given interface.
Describe the bug
The
onerror
function defined in.stream
checks if the received error is an instance ofMessasgeEvent
- this works fine in the browser but it will fail if you are running in node, sinceMessageEvent
is not part of Node's API.js-stellar-sdk/src/call_builder.ts
Line 144 in 992e828
What version are you on?
2.2.0
To Reproduce
Steps to reproduce the behavior:
git clone js-stellar-canary
cd js-stellar-canary
yarn
node --experimental-modules src/streaming.js
Expected behavior
If there is an error from the stream, then it should be handled by my onerror function, but instead we get
Additional context
This error was originally reported by @danieldeusing on keybase
The text was updated successfully, but these errors were encountered: