n8n icon indicating copy to clipboard operation
n8n copied to clipboard

Rabbit MQ triggers do not work in test mode

Open DRIMOL opened this issue 11 months ago • 54 comments

Bug Description

A - Does not pull the item from the queue in test mode

B - If you write a message to a queue that does not exist, it returns an error. ERROR: Operation failed: QueueDeclare; 404 (NOT-FOUND) with message "NOT_FOUND - no queue 'test_queue' in vhost 'default'

To Reproduce

A1 - adicione uma nova mensagem no rabbit mq A2 - coloque o triggers em modo de escuta

A PS: No painel do rabbit MQ a messagem entra em Unacked, mas, no workflow do n8n nada acontece

B1 - try to write a message to a queue that doesn't exist

Expected behavior

A - Test message reception by rabbit MQ

B - Create new queues through the RabbitMQ node

Operating System

UbuntoLinux 20

n8n Version

1.31.2

Node.js Version

v18.19.1

Database

PostgreSQL

Execution mode

queue

DRIMOL avatar Mar 12 '24 23:03 DRIMOL

Hey @DRIMOL,

Thanks for reporting this, I have created NODE-1230 as the ticket to fix the bug, With the second one I would expect it to fail if the queue doesn't exist as we don't set the option to create it.

If you want us to add this I would recommend creating a feature request on the community support forum and we can track the popularity of this and look at adding it in the future.

Joffcom avatar Mar 13 '24 11:03 Joffcom

I thought it was a BUG, ​​because in version 1.24.1 it creates the queue if it doesn't exist.

Thanks

DRIMOL avatar Mar 13 '24 13:03 DRIMOL

Hey @DRIMOL,

That was some important information that was missing... Looking at the release this was changed in 1.28.0 with this PR: https://github.com/n8n-io/n8n/pull/8430 and it looks like I missed that the change was not added to the standard node.

I will get that fixed shortly for the next release.

Joffcom avatar Mar 13 '24 16:03 Joffcom

Where can I track the progress?

DRIMOL avatar Mar 20 '24 19:03 DRIMOL

Hey @DRIMOL,

This is the best place to check, Once fixed we will put a note on here to let you know. You can also keep an eye on the PR list to see if any of them contain node-1230.

Right now this is sat with a high priority and is waiting to be picked up.

Joffcom avatar Mar 21 '24 10:03 Joffcom

Actually, better to have an option like "Create if no queue" to avoid misconfigurations.

But I can imagine only one scenario when it might be needed - If someone by mistake has deleted a queue

barn4k avatar Apr 11 '24 21:04 barn4k

Hey @Joffcom , bug with the 404 instead of creating a queue is still there...

barn4k avatar May 10 '24 13:05 barn4k

I have created a PR to fix the queue creation, Oddly enough when testing I noticed that running in test mode is working as well. @DRIMOL / @barn4k are you able to check on 1.41.0 to see if the test execution is working for an existing queue?

Joffcom avatar May 13 '24 14:05 Joffcom

Thanks to a quick review from @netroy it looks like the option to make the queue is there already under Add Option > Assert Queue. This should resolve the issue of the queue not being created automatically.

Joffcom avatar May 13 '24 14:05 Joffcom

I have created a PR to fix the queue creation, Oddly enough when testing I noticed that running in test mode is working as well. @DRIMOL / @barn4k are you able to check on 1.41.0 to see if the test execution is working for an existing queue?

Well, I can't check it right now as the latest docker version is 1.39.1 :)

barn4k avatar May 15 '24 09:05 barn4k

@barn4k latest should be 1.41.0 now 😄

Joffcom avatar May 15 '24 15:05 Joffcom

@Joffcom Just tested on 1.41.1, Test Workflow/Test Step still don't work. It keeps loading forever image

And I see that the node tried to consume the message but it stucked there (Unacked state) image

Even after I have stopped the execution, it still holds the message image

I've tried both: using the current RabbitMQ node and creating a totally new one

barn4k avatar May 16 '24 14:05 barn4k

I have created a PR to fix the queue creation, Oddly enough when testing I noticed that running in test mode is working as well. @DRIMOL / @barn4k are you able to check on 1.41.0 to see if the test execution is working for an existing queue?

Well, I can't check it right now as the latest docker version is 1.39.1 :)

here it is also loading infinite Captura de Tela 2024-05-16 às 15 40 30 na versão 1.41.0

DRIMOL avatar May 16 '24 18:05 DRIMOL

Thanks to a quick review from @netroy it looks like the option to make the queue is there already under Add Option > Assert Queue. This should resolve the issue of the queue not being created automatically.

yes, it already exists in the trigger, but the interesting thing would be if it was in the "Send a Message to RabbitMQ", because then we would be able to create queues dynamically.

DRIMOL avatar May 16 '24 18:05 DRIMOL

Será que ainda vão resolver ? 😞

DRIMOL avatar Jun 06 '24 18:06 DRIMOL

@Joffcom Setting Up N8N_LOG_LEVEL=verbose I can see the error that happens when the rabbit trigger is started:

2024-06-06T22:56:04.076Z | error    | There was a problem with the RabbitMQ Trigger node "RabbitMQ Trigger" in workflow "hAKRgkvpANXAoSTW": "Overwrite NodeExecuteFunctions.getExecuteTriggerFunctions.emit function" "{\n  node: 'RabbitMQ Trigger',\n  workflowId: 'hAKRgkvpANXAoSTW',\n  file: 'LoggerProxy.js',\n  function: 'exports.error'\n}"

luizeof avatar Jun 06 '24 22:06 luizeof

This will be fixed very soon.

Joffcom avatar Jun 27 '24 15:06 Joffcom

This will be fixed very soon.

I would like to add a bug that I noticed these days also about the rabbit

If I inactivate or delete an n8n flow where there is a rabbit trigger, the consumer is not automatically deleted from the rabbit, and continues to be sent to a ghost consumer, even though it has been deleted, the problem is only solved by updating n8n with prune , by doing this he excludes ghost consumers.

DRIMOL avatar Jul 01 '24 13:07 DRIMOL

If I inactivate or delete an n8n flow where there is a rabbit trigger, the consumer is not automatically deleted

When you deactivate the workflow, do you see any error in the container logs saying something like There was a problem closing the RabbitMQ Trigger node connection?

netroy avatar Jul 01 '24 14:07 netroy

If I inactivate or delete an n8n flow where there is a rabbit trigger, the consumer is not automatically deleted

When you deactivate the workflow, do you see any error in the container logs saying something like There was a problem closing the RabbitMQ Trigger node connection?

I will try to check if I should look at this log in the n8n workers or in the RabbitMQ container?

DRIMOL avatar Jul 01 '24 14:07 DRIMOL

I will try to check if I should look at this log in the n8n workers or in the RabbitMQ container?

Please check in the n8n worker logs.

netroy avatar Jul 01 '24 15:07 netroy

I tried to catch the bug here, but it excluded the consumer, it could have happened because the queue had a stuck message, for example when "parse json" is marked and the message arrives outside of the json format, in this case or something similar does not exclude, but by deleting a trigger that is "healthy" here the consumers were excluded from the rabbit

DRIMOL avatar Jul 01 '24 20:07 DRIMOL

@Joffcom Setting Up N8N_LOG_LEVEL=verbose I can see the error that happens when the rabbit trigger is started:

2024-06-06T22:56:04.076Z | error    | There was a problem with the RabbitMQ Trigger node "RabbitMQ Trigger" in workflow "hAKRgkvpANXAoSTW": "Overwrite NodeExecuteFunctions.getExecuteTriggerFunctions.emit function" "{\n  node: 'RabbitMQ Trigger',\n  workflowId: 'hAKRgkvpANXAoSTW',\n  file: 'LoggerProxy.js',\n  function: 'exports.error'\n}"

Same error as mine

ianpogi5 avatar Jul 08 '24 10:07 ianpogi5

"Overwrite NodeExecuteFunctions.getExecuteTriggerFunctions.emit function"

This error makes me wonder if the node_modules package is somehow tampered.

@ianpogi5 Are you running n8n on docker? and do you have any custom or community nodes installed?

netroy avatar Jul 08 '24 10:07 netroy

"Overwrite NodeExecuteFunctions.getExecuteTriggerFunctions.emit function"

This error makes me wonder if the node_modules package is somehow tampered.

@ianpogi5 Are you running n8n on docker? and do you have any custom or community nodes installed?

We are using docker version.

ianpogi5 avatar Jul 08 '24 11:07 ianpogi5

We are using docker version.

and do you have any custom or community nodes installed?

netroy avatar Jul 08 '24 11:07 netroy

We are using docker version.

and do you have any custom or community nodes installed?

Yes we have 1 which is the netsuite node. We don't use then together on the same flow if that matters.

ianpogi5 avatar Jul 08 '24 13:07 ianpogi5

n8n-nodes-netsuite is pulling in a really old version of n8n-core, and likely messing with the core functionality. Can you please try uninstalling the node, restarting n8n, and checking if that fixes the issue? If it does, I can send a PR to n8n-nodes-netsuite to update their code.

netroy avatar Jul 08 '24 14:07 netroy

@netroy In this comment last month I had the same problem, without community nodes, running on docker

https://github.com/n8n-io/n8n/issues/8871#issuecomment-2153529729

luizeof avatar Jul 08 '24 18:07 luizeof