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

Some rabbitmq endpoint seems not exposed #388

Open
slord399 opened this issue Jan 28, 2025 · 6 comments
Open

Some rabbitmq endpoint seems not exposed #388

slord399 opened this issue Jan 28, 2025 · 6 comments

Comments

@slord399
Copy link

slord399 commented Jan 28, 2025

Describe the bug

This is not severe bug kind so not in hurry as bot itself works without rabbitmq.
*Unless so many feeds coming in at once which overharm numbers cannot handle without queue.

As I got own rabbitmq instance instead of docker, I try to replace all with my own one which has disabled guest access for security. when I build it with modified amqp URI, it works but seems endless amqp URL error occure on few docker component. Is some endpoint setting not exposed and trying to access it though guest account instead?

[Nest] 1  - 01/28/2025, 5:25:03 PM   ERROR [AmqpConnection] Failed to connect to RabbitMQ broker (default)

URIError: URI malformed

    at decodeURIComponent (<anonymous>)

    at new Url (/usr/src/app/node_modules/url-parse/index.js:391:41)

    at Url (/usr/src/app/node_modules/url-parse/index.js:245:12)

    at connect (/usr/src/app/node_modules/amqplib/lib/connect.js:131:17)

    at /usr/src/app/node_modules/amqplib/channel_api.js:7:12

    at node:internal/util:455:21

    at new Promise (<anonymous>)

    at node:internal/util:441:12

    at Object.connect (/usr/src/app/node_modules/amqplib/channel_api.js:8:5)

    at /usr/src/app/node_modules/amqp-connection-manager/dist/cjs/AmqpConnectionManager.js:266:25

To Reproduce

Steps to reproduce the behavior:

  1. Replace endpoint ID/PW on following files.

    - BACKEND_API_RABBITMQ_BROKER_URL=amqp://guest:guest@rabbitmq-broker:5672/

    - BACKEND_API_RABBITMQ_BROKER_URL=amqp://guest:guest@mrss-rabbitmq-broker:5672/

    - USER_FEEDS_RABBITMQ_BROKER_URL=amqp://guest:guest@mrss-rabbitmq-broker:5672

    - USER_FEEDS_DISCORD_RABBITMQ_URI=amqp://guest:guest@rabbitmq:5672

    - USER_FEEDS_RABBITMQ_BROKER_URL=amqp://guest:guest@rabbitmq:5672

  2. build

  3. Check docker log for monolith (and some other which output error provided)

Expected behavior

Simply successfully connected to RabbitMQ without issue.

Screenshots

Image

If applicable, add screenshots to help explain your problem.

Branch (please specify one):

master

Additional context

If it possible, then I can remove docker version of rabbitmq completely so it save on resource.

Also more ideally, exposed those settings to enviroment file for make it able to set when initial setup.
(Having existing rabbitmq be something common which also can say same to port number used as port number currently used can be conflicted with existing asset.)

@synzen
Copy link
Owner

synzen commented Feb 3, 2025

Hi, RabbitMQ is necessary for article delivery. URI malformed typically means that the URI that you've inputted is incorrectly formatted - I suggest taking a closer look at what you've inputted as the URI to make sure that it is a valid RabbitMQ URI

@slord399
Copy link
Author

slord399 commented Feb 4, 2025

One point to clarify is that if I allowe guest account on rabbitmq, it allow without issue at all.
But for security concern highly if bot is hosted on VPS and actually got spammer on amqp be commonly happen every day, I don't want to allow guest access at all.

Can you try at least with non-guest access enviroment to reproduce this issue?
(as URI format I input on all location is correct and valied as confirmed multiple times but still output same error at all which sus me some module trying to access without auth without shown up on file to build with)

@synzen
Copy link
Owner

synzen commented Feb 4, 2025

If you delete the guest user, and you're still using guest credentials in the URI, then there's a chance that may also be the cause of your issue - please see https://www.rabbitmq.com/docs/uri-spec for the format of the RabbitMQ URI

To save you effort with any mal-configurations in either the RabbitMQ server or URI formatting, https://www.cloudamqp.com/ offers a free cloud-hosted RabbitMQ server that gives you a full and valid URI (that has no guest user). You can either use this going forward, or use it as an example for what the URI should look like

@slord399
Copy link
Author

slord399 commented Feb 5, 2025

Things is I already got rabbitmq instance on local machine for other asset to use and running without issue so more likely.....guest:guest@ is missing from 1 of yml endpoint amqp: string which make it guest access possibly so I need to investigate which line is missing that.

I'll check it out but may takes time.
(I just use production instance which is on machine so URI should be correct, unless unintentionally accessing to guest from your code)

@synzen
Copy link
Owner

synzen commented Feb 11, 2025

I understand - I was just saying that you can try to use the cloud-based RabbitMQ so that it has a full and valid URI for you to at least reference as an example and look for possible discrepancies

There is no place in the code that accesses guest because the public instance in production does not use the guest account, nor does it access anything via guest

@slord399
Copy link
Author

Thank you for confirming at least.
I shall investigate bit more further this weekend (I hope I can grab time for it) and see what is root of issue here.

I got few clue to try out to see it.
(At least there is no issue of such, I think I got clue for it by now after read code other day. )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants