question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(Exactly once delivery) BatchError: Failed to "modifyAckDeadline" Reason: 3 INVALID_ARGUMENT.

See original GitHub issue
  1. Is this a client library issue or a product issue? Client Library Issue.

  2. Did someone already solve this?

  1. Do you have a support contract? No.

If the support paths suggested above still do not result in a resolution, please provide the following details.

Environment details

  • OS: Mac OS Monterey 12.3.1 (M1)
  • Node.js version: v14.19.1
  • npm version: 6.14.16
  • @google-cloud/pubsub version: ^2.19.0

Steps to reproduce

  1. Create a Topic and Subscription for a project in the PubSub console. a) Assign the google API scope: gmail-api-push@system.gserviceaccount.com to the topic and subscription. b) Enable “Exactly once delivery” for the subscription.
  2. Create a project which watches a mailbox for unread messages and gets the subscription just created:
const pubsub = new PubSub({ projectId: 'example-project' });
const sub = await pubsub.subscription('example-project-sub');

sub.on('error', async (error) => {
  console.info('Pubsub subscribe error: ', error);
});

sub.on('message', async (message) => {
  try {
    message.ack();
  } catch (err) {
    console.info(err);
  }
});

await gmail.users.watch({
    userId: 'me',
    requestBody: {
      labelIds: ['UNREAD'],
      topicName: `projects/example-project/topics/example-project-topic`,
    },
  })

(Authentication Code):

  const { google } = require('googleapis');

  const JWT = google.auth.JWT;
  const auth = new JWT({
    keyFile: 'credentials-service.json',
    scopes: ['https://www.googleapis.com/auth/gmail.readonly', 'https://mail.google.com/'],
    subject: 'email@gmail.com',
  });

  await auth.authorize();

  const gmail = google.gmail({
    auth,
    version: 'v1',
  });
  1. Run the project concurrently with at least 2 instances.
  2. Send 10 unique emails to the email matched to the topic in fast succession.
  3. Witness the error appear:
BatchError: Failed to "modifyAckDeadline" for 1 message(s). Reason: 3 INVALID_ARGUMENT: Some acknowledgement ids in the request were invalid. This could be because the acknowledgement ids have expired or the acknowledgement ids were malformed.
   at ./example-project/node_modules/@google-cloud/pubsub/src/message-queues.ts:258:15
   at async Promise.all (index 0)
   at async ModAckQueue._sendBatch (./example-project/node_modules/@google-cloud/pubsub/src/message-queues.ts:262:5)
   at async ModAckQueue.flush (./example-project/node_modules/@google-cloud/pubsub/src/message-queues.ts:142:7) {
 ackIds: [
   'BhYsXUZIUTcZCGhRDk9eIz81IChFEgADZ3kiHkYfYmhcXHUHUAUZei5hcmNbRwkIR1Z0X3MrFZ22qtYxUa3P8PXZdUh6FwULRVp_WV8ZC2tfX3YPUyWguYL5j-KZJBs-faaUqfgtLZu7y682Zi09WhJLLD5-NTZFQV5AEkw-A0RJUytDCypYEU4EISE-MD5FU0RQ'
 ],
 code: 3,
 details: 'Some acknowledgement ids in the request were invalid. This could be because the acknowledgement ids have expired or the acknowledgement ids were malformed.',
 metadata: Metadata {
   internalRepr: Map(2) {
     'google.rpc.errorinfo-bin' => "EXACTLY_ONCE_ACKID_FAILUREpubsub.googleapis.com�
�BhYsXUZIUTcZCGhRDk9eIz81IChFEgADZ3kiHkYfYmhcXHUHUAUZei5iI2gPG1AIRlp0X3MrFcCaqtYxUa3P8PXZdUh6FwULRVp9X10TDWlVX3IGVCWguYL5j-KZJBs-ffu4qfgtLYDZlqg2Zi09WhJLLD5-NTZFQV5AEkw-A0RJUytDCypYEU4EISE-MD5FU0RQ PERMANENT_FAILURE_INVALID_ACK_ID",
     'grpc-status-details-bin' => "�Some acknowledgement ids in the request were invalid. This could be because the acknowledgement ids have expired or the acknowledgement ids were malformed.�
(type.googleapis.com/google.rpc.ErrorInfo�
EXACTLY_ONCE_ACKID_FAILUREpubsub.googleapis.com�
�BhYsXUZIUTcZCGhRDk9eIz81IChFEgADZ3kiHkYfYmhcXHUHUAUZei5iI2gPG1AIRlp0X3MrFcCaqtYxUa3P8PXZdUh6FwULRVp9X10TDWlVX3IGVCWguYL5j-KZJBs-ffu4qfgtLYDZlqg2Zi09WhJLLD5-NTZFQV5AEkw-A0RJUytDCypYEU4EISE-MD5FU0RQ PERMANENT_FAILURE_INVALID_ACK_ID"
   },
   options: {}
 }
}

Additional Details:

  • There is no online record of this extended error log: "Some acknowledgement ids in the request were invalid. This could be because the acknowledgement ids have expired or the acknowledgement ids were malformed.".
    • Except for this PR in the pubsub .net repo.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:25

github_iconTop GitHub Comments

3reactions
Bielykh-Artemcommented, Oct 5, 2022

3.2.0 issue still actual error: OTHER : 3 INVALID_ARGUMENT: Some acknowledgement ids in the request were invalid. This could be because the acknowledgement ids have expired or the acknowledgement ids were malformed. at /Users/capgemini/projects/medable/screenshot-service/node_modules/@google-cloud/pubsub/src/message-queues.ts:419:21 at Array.forEach (<anonymous>) at ModAckQueue.handleAckFailures (/Users/capgemini/projects/medable/screenshot-service/node_modules/@google-cloud/pubsub/src/message-queues.ts:418:12) at /Users/capgemini/projects/medable/screenshot-service/node_modules/@google-cloud/pubsub/src/message-queues.ts:563:33 at async Promise.all (index 0) at async ModAckQueue._sendBatch (/Users/capgemini/projects/medable/screenshot-service/node_modules/@google-cloud/pubsub/src/message-queues.ts:574:45) at async ModAckQueue.flush (/Users/capgemini/projects/medable/screenshot-service/node_modules/@google-cloud/pubsub/src/message-queues.ts:269:23) { errorCode: ‘OTHER’

1reaction
bonzzycommented, Nov 14, 2022

Is there any progress made on this part? I get the same error when using exactly once delivery and NodeJs. ackError: INVALID : 3 INVALID_ARGUMENT: Some acknowledgement ids in the request were invalid

Is the solution for now not to use exactly once delivery with NodeJs?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cloud Pub/Sub Exactly-once Delivery feature is now ...
A subscriber application will connect to Pub/Sub for the subscription to start receiving messages (either through a pull or push delivery ...
Read more >
Pub/Sub re-sending message after 10 sec even setting ack ...
I'm using Pub/Sub for message delivery and I have set the ack. deadline 600 sec which is ...
Read more >
pubsub - Go Packages
func SetAckResult(r *AckResult, res AcknowledgeStatus, err error) ... If exactly-once delivery is enabled on the subscription, the AckResult ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found