Queue.push always throws InternalServerError 400

Hi Everyone,
I’m trying to setup new long running job and whenever I push my job to queue it always throws below error

Push failed: InternalServerError: 400 Bad Request
    at validateAPIResponse (webpack://confluence-space-settings-custom-ui/node_modules/@forge/events/out/validators.js:75:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at validatePushAPIResponse (webpack://confluence-space-settings-custom-ui/node_modules/@forge/events/out/validators.js:107:1)
    at Queue.push (webpack://confluence-space-settings-custom-ui/node_modules/@forge/events/out/queue.js:31:1)
    at Object.update (webpack://confluence-space-settings-custom-ui/src/index.js:127:1)

My push payload is below

await queue.push({
      body: {
        step: 1,
        message: 'Start processing'
      }
    });

Adding few more logs for reference

INFO    12:03:13.809  c9c7dfc9-b40b-4335-99b7-69d8137e2112  Queue {
  queueParams: { key: 'long-job-queue' },
  apiClient: [AsyncFunction (anonymous)]
}
INFO    12:03:13.810  c9c7dfc9-b40b-4335-99b7-69d8137e2112  Pushing an event to the queue
INFO    12:03:13.811  c9c7dfc9-b40b-4335-99b7-69d8137e2112  Payload: {"step":1,"message":"Start processing"}
ERROR   12:03:14.867  c9c7dfc9-b40b-4335-99b7-69d8137e2112  Push failed: InternalServerError: 400 Bad Request
    at validateAPIResponse (webpack://confluence-space-settings-custom-ui/node_modules/@forge/events/out/validators.js:75:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Any assistance/suggestions would be helpful

Thanks in advance,
Leo

1 Like

Can you show us the consumer module in your manifest.yml?

sure, please find the same below

  consumer:
    - key: long-job-queue-key
      queue: long-job-queue
      function: page-sorter  

@klaussner, thanks for looking into this. I have fixed the issue

Hi Leo I have the same issue. May I know how you fixed it?
Thanks,
YY1

You most likely have differences between v1 and v2 of the event queue. Check you manifest and the listener (without resolver in v2).

4 Likes

this comment helped point me at the documentation: https://developer.atlassian.com/platform/forge/runtime-reference/async-events-api-version-2-upgrade/

thx