Search code examples
firebasefunctionqueuetaskgcloud

NOT_FOUND when adding tasks to Google Cloud Tasks


I'm getting an error called NOT_FOUND while adding tasks to Google Cloud Tasks from the Firebase Functions. It's only 1 task that I tried to add. Not sure why this is happening.

The queue is present and from the command line, it works fine.

Here is the detailed error log:

Error: 5 NOT_FOUND: Requested entity was not found.
    at Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
    at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:189:52)
    at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)
    at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
    at /workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:187:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

It would save my day.

Thanks in advance


Solution

  • check the service account email you are using, suppose you have the task object like this:

      const task = {
        httpRequest: {
          httpMethod: 'POST',
          url,
          body: Buffer.from(JSON.stringify((payload))).toString('base64'), // required by cloud tasks api
          headers: {
            'Content-Type': 'application/json',
          },
          oidcToken: {
            serviceAccountEmail // check if this is a valid serviceAccountEmail
          }
        },
        scheduleTime: {
          seconds: sendAtSeconds // THE STUFF
        }
      }