In manifest I have
function:
- key: migrationEventHandeller
handler: index.migrationQueueHandler
timeoutSeconds: 900
consumer:
- key: migration-consumer
queue: migration-queue
function: migrationEventHandeller
runtime:
name: nodejs22.x
in Handler I have
const queue = new Queue({ key: "migration-queue" });
export const postToQueue = async () => {
await postFirstToQueue();
console.log("pushing type2");
await queue.push({ body: { type: "TYPE2"} });
}
export const postFirstToQueue = async () => {
await queue.push({ body: { type: "TYPE1" } });
}
export async function migrationQueueHandler(event: any, context: any) {
if (event.body.type === "TYPE1") {
await doSomething1();
}
if (event.body.type === "TYPE2") {
await doSomething2();
}
return "done";
}
async function doSomething1 () {console.log('in type1');}
async function doSomething2 () {console.log('in type2');}
When i call
export const postToQueue = async () => {
await postFirstToQueue();
console.log("pushing type2");
await queue.push({ body: { type: "TYPE2"} });
}
postFirstToQueue is executed and also the event is processed. however TYPE2 is not processed at all. infact “pushing type2” is not printed at all. there is no error in console.
i am using below dependencies
"dependencies": {
"@forge/api": "^5.3.0",
"@forge/events": "^2.0.4",
"@forge/resolver": "^1.6.12",
"@forge/sql": "^3.0.6",
"drizzle-orm": "^0.44.5",
"forge-sql-orm": "^2.1.5",
"jsonwebtoken": "^9.0.2",
"moment": "^2.30.1",
"uuid": "^13.0.0"
}
What can be the problem? I am using typescript.
Thanks
Shiv