ccc
ccc3w ago

@google-cloud/tasks not working

I'm trying to use the Cloud Tasks emulator from a Deno script using the @google-cloud/tasks npm package. I run the following code with deno run -A <path>, but I always get a timeout error like this:
Operation failed: Error: Total timeout of API google.cloud.tasks.v2.CloudTasks exceeded 20000 milliseconds before any response was received.
Operation failed: Error: Total timeout of API google.cloud.tasks.v2.CloudTasks exceeded 20000 milliseconds before any response was received.
code
import { CloudTasksClient } from "@google-cloud/tasks";
import { credentials } from "@grpc/grpc-js";

async function main() {
const client = new CloudTasksClient({
servicePath: "127.0.0.1",
port: 8123,
sslCreds: credentials.createInsecure(),
});

try {
const [queues] = await client.listQueues({
parent: "projects/****/locations/****",
});
console.log(queues);
} catch (error) {
console.error(error);
} finally {
await client.close();
}
}

await main();
import { CloudTasksClient } from "@google-cloud/tasks";
import { credentials } from "@grpc/grpc-js";

async function main() {
const client = new CloudTasksClient({
servicePath: "127.0.0.1",
port: 8123,
sslCreds: credentials.createInsecure(),
});

try {
const [queues] = await client.listQueues({
parent: "projects/****/locations/****",
});
console.log(queues);
} catch (error) {
console.error(error);
} finally {
await client.close();
}
}

await main();
- Deno: 2.2.12 - @google-cloud/tasks: 6.0.1 - @grpc/grpc-js: 1.13.3 - Cloud Tasks emulator: ghcr.io/aertje/cloud-tasks-emulator:latest compose.yaml
cloud-tasks-emulator:
image: ghcr.io/aertje/cloud-tasks-emulator:latest
ports:
- "8123:8123"
command: >
-host 0.0.0.0
-port 8123
-queue projects/****/locations/****/queues/****
cloud-tasks-emulator:
image: ghcr.io/aertje/cloud-tasks-emulator:latest
ports:
- "8123:8123"
command: >
-host 0.0.0.0
-port 8123
-queue projects/****/locations/****/queues/****
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?