Window not defined Error when using jsm.streams.getMessage("streamname", 1) syntax
See original GitHub issueHi! Thanks for your awesome work on NATS/Jetstream’s javascript client.
I encountered an error when I am using getMessage
function.
The code line that has an error is just the same as in the tutorial.
let sm = await jsm.streams.getMessage(stream, 1);
The error is as below:
ReferenceError: window is not defined
at StoredMsgImpl._parse (/node_modules/nats/lib/nats-base-client/jsstream_api.js:121:20)
at new StoredMsgImpl (/node_modules/nats/lib/nats-base-client/jsstream_api.js:111:45)
at StreamAPIImpl.<anonymous> (/node_modules/nats/lib/nats-base-client/jsstream_api.js:98:20)
at Generator.next (<anonymous>)
at fulfilled (/node_modules/nats/lib/nats-base-client/jsstream_api.js:19:58)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
I felt the error quite confusing and does not understand what is happening behind it. Has anyone encountered same error and have some ideas? Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Error `window not defined` in Node.js - Stack Overflow
Sawtaytoes has got it. I would run whatever code you have in componentDidMount() and surround it with: if (typeof(window) !== 'undefined') ...
Read more >Accessing alternative data-streams of files on an NTFS volume
A pair of classes to encapsulate access to NTFS alternative data streams. ... include support for them with a special file syntax: Filename.ext:StreamName...
Read more >JavaMail API Tutorial - Tutorialspoint
The JavaMail API provides a set of abstract classes defining objects ... This class represents an Internet email address using the syntax of....
Read more >How to solve "window is not defined" errors in React and Next.js
js world, window is not defined, window is only available in browsers. There are three ways to solve that: 1. First solution: typeof....
Read more >[Solved] ReferenceError : window is not defined - ItsJavaScript
Solution 1: Check whether browser or server-side execution · Solution 2: If error occurs while running on browser · How to use Global...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll keep it open as a task…
@300LiterPropofol
npm install nats@latest
to get the fix.