-
Notifications
You must be signed in to change notification settings - Fork 8
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
Error: Class extends value undefined is not a constructor or null #27
Comments
This library does not work in the browser. Perhaps I'll add support in the future. But not any time soon.
…-------- Original Message --------
On Jul 27, 2023, 6:00 AM, Anton Lovrić wrote:
Hey everyone, I have a RabbitMQ broker running in the background and a .NET Core backend publishing messages. I need to connect to the broker inside my React app I created using Vite. This is the code I use for connecting to the broker:
import
{
Connection
}
from
'rabbitmq-client'
;
useEffect
(
(
)
=>
{
const
rabbit
=
new
Connection
(
NOTIFICATION_API
)
;
rabbit
.
on
(
'connection'
,
(
)
=>
{
console
.
log
(
'connected'
)
;
}
)
;
rabbit
.
on
(
'error'
,
(
)
=>
{
console
.
log
(
'error'
)
;
}
)
;
return
(
)
=>
{
rabbit
.
close
(
)
;
}
;
}
,
[
]
)
;
But I get this error when the code snippet is called:
Uncaught TypeError: Class extends value undefined is not a constructor or null
at node_modules/rabbitmq-client/lib/util.js (util.js:106:43)
at __require2 (chunk-WQG2LZMB.js?v=fa4e550a:16:50)
at node_modules/rabbitmq-client/lib/Connection.js (Connection.js:11:16)
at __require2 (chunk-WQG2LZMB.js?v=fa4e550a:16:50)
at node_modules/rabbitmq-client/lib/index.js (index.js:4:22)
at __require2 (chunk-WQG2LZMB.js?v=fa4e550a:16:50)
at index.js:12:126
Any idea what I'm doing wrong or what I can do to resolve this issue?
Side note, this warning also shows up in the browser console:
Module "node:stream" has been externalized for browser compatibility. Cannot access "node:stream.Writable" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
—
Reply to this email directly, [view it on GitHub](#27), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABQGAS3BK3XIAPNKVGYHY6LXSJQ5DANCNFSM6AAAAAA22BQD3M).
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Oh alright, do you have any recommendations which library I can use on the client side? |
I believe cloudamqp maintains a library which uses web sockets.
…-------- Original Message --------
On Jul 27, 2023, 8:24 AM, Anton Lovrić wrote:
> This library does not work in the browser. Perhaps I'll add support in the future. But not any time soon.
>
> -------- Original Message --------
> On Jul 27, 2023, 6:00 AM, Anton Lovrić wrote:
>
>> Hey everyone, I have a RabbitMQ broker running in the background and a .NET Core backend publishing messages. I need to connect to the broker inside my React app I created using Vite. This is the code I use for connecting to the broker:
>>
>> import
>>
>> {
>>
>> Connection
>>
>> }
>>
>> from
>>
>> 'rabbitmq-client'
>>
>> ;
>>
>> useEffect
>>
>> (
>>
>> (
>>
>> )
>>
>> =>
>>
>> {
>>
>> const
>>
>> rabbit
>>
>> =
>>
>> new
>>
>> Connection
>>
>> (
>>
>> NOTIFICATION_API
>>
>> )
>>
>> ;
>>
>> rabbit
>>
>> .
>>
>> on
>>
>> (
>>
>> 'connection'
>>
>> ,
>>
>> (
>>
>> )
>>
>> =>
>>
>> {
>>
>> console
>>
>> .
>>
>> log
>>
>> (
>>
>> 'connected'
>>
>> )
>>
>> ;
>>
>> }
>>
>> )
>>
>> ;
>>
>> rabbit
>>
>> .
>>
>> on
>>
>> (
>>
>> 'error'
>>
>> ,
>>
>> (
>>
>> )
>>
>> =>
>>
>> {
>>
>> console
>>
>> .
>>
>> log
>>
>> (
>>
>> 'error'
>>
>> )
>>
>> ;
>>
>> }
>>
>> )
>>
>> ;
>>
>> return
>>
>> (
>>
>> )
>>
>> =>
>>
>> {
>>
>> rabbit
>>
>> .
>>
>> close
>>
>> (
>>
>> )
>>
>> ;
>>
>> }
>>
>> ;
>>
>> }
>>
>> ,
>>
>> [
>>
>> ]
>>
>> )
>>
>> ;
>>
>> But I get this error when the code snippet is called:
>>
>> Uncaught TypeError: Class extends value undefined is not a constructor or null
>> at node_modules/rabbitmq-client/lib/util.js (util.js:106:43)
>> at __require2 (chunk-WQG2LZMB.js?v=fa4e550a:16:50)
>> at node_modules/rabbitmq-client/lib/Connection.js (Connection.js:11:16)
>> at __require2 (chunk-WQG2LZMB.js?v=fa4e550a:16:50)
>> at node_modules/rabbitmq-client/lib/index.js (index.js:4:22)
>> at __require2 (chunk-WQG2LZMB.js?v=fa4e550a:16:50)
>> at index.js:12:126
>>
>> Any idea what I'm doing wrong or what I can do to resolve this issue?
>>
>> Side note, this warning also shows up in the browser console:
>>
>> Module "node:stream" has been externalized for browser compatibility. Cannot access "node:stream.Writable" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
>>
>> —
>> Reply to this email directly, [view it on GitHub](#27), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABQGAS3BK3XIAPNKVGYHY6LXSJQ5DANCNFSM6AAAAAA22BQD3M).
>> You are receiving this because you are subscribed to this thread.Message ID: @.***>
Oh alright, do you have any recommendations which library I can use on the client side?
—
Reply to this email directly, [view it on GitHub](#27 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABQGAS7A3SJSGGVQEP4TFYLXSKB2LANCNFSM6AAAAAA22BQD3M).
You are receiving this because you commented.Message ID: ***@***.***>
|
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey everyone, I have a RabbitMQ broker running in the background and a .NET Core backend publishing messages. I need to connect to the broker inside my React app I created using Vite. This is the code I use for connecting to the broker:
But I get this error when the code snippet is called:
Any idea what I'm doing wrong or what I can do to resolve this issue?
Side note, this warning also shows up in the browser console:
The text was updated successfully, but these errors were encountered: