Getting "Invalid header" error when invoking `message.ack()`
See original GitHub issueI get this error when I invoke message.ack()
:
Broker reported error: Invalid header [some-file].js:78 Additional details: “ACK” must include a valid “id” header
Initially I was invoking .ack()
with no arguments as shown in the docs, i.e. just simply message.ack()
.
However after first noticing the error and seeing that those docs state that all 3 arguments are not optional, I changed to this:
const messageId = message.headers['message-id'] || undefined;
const subscriptionId = message.headers.subscription || undefined;
message.ack(messageId, subscriptionId, {});
I still got the error, so I switched to this:
const messageId = message.headers['message-id'] || undefined;
const subscriptionId = message.headers.subscription || undefined;
message.ack(messageId, subscriptionId, message.headers);
And I’m still getting the error. How can I fix this error? Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
I am getting an "Invalid Host header" message when ...
The problem occurs because webpack-dev-server 2.4.4 adds a host check. You can disable it by adding this to your webpack config:
Read more >FIX: Invalid message error if the header field is longer than ...
Fixes an issue that triggers an invalid message error if a message in BizTalk Server has a header field that's more than 1000...
Read more >Why I am getting " Attempt to use invalid header in request"
I am trying to upload a file by using REST API in salesforce but getting the above error. public static PageReference upload(String at,Blob ......
Read more >Error 10012 - Invalid value for header
This error message indicates that the value passed in the header is invalid. From the LongMessage tag, it indicates that US is not...
Read more >HTTP response status codes - MDN Web Docs - Mozilla
HTTP response status codes indicate whether a specific HTTP request has been successfully completed. Responses are grouped in five classes:
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 Free
Top 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
I could notice one critical difference, your log output does not show an
ack
header in the message (below is a sample from my system with RabbitMQ 3.8.0):Are you setting correct headers when subscribing? Please see https://stomp-js.github.io/guide/stompjs/using-stompjs-v5.html#acknowledgment. You need to set
{ ack: 'client' }
to use ack/nack.Thanks! I needed to add
{ ack: 'client' }
when subscribing.