Search code examples
javascriptnode.jsgoogle-cloud-functionsgoogle-cloud-tasks

Error: 3 INVALID_ARGUMENT: Invalid resource field value in the request


I am following a List Queues sample to lists all the queues. But, I get below error:

Error: 3 INVALID_ARGUMENT: Invalid resource field value in the request.
    at Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
    at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:190: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:188:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

Some code snippet:

const parent = client.locationPath(project, location);
const [queues] = await client.listQueues({parent});

if (queues.length > 0) {
  console.log('Queues:');
  queues.forEach(queue => {
    console.log(` ${queue.name}`);
  });
} else {
  console.log('No queues found!');
}

I am not very sure whether the error is derived from this line:

const [queues] = await client.listQueues({parent});

Appreciate if someone can advise. Thank you in advance!


Solution

  • I just change

    const [queues] = await client.listQueues({parent});
    

    to

    const [queues] = await client.listQueues({parent: parent});
    

    and the problem is solved.