how to trigger a defined workflow

Hi I am trying to trigger this workflow but I keep getting an error telling me that the workflow does'nt exist
const myWorkflow = workflow(
"new-signup",
async ({ step, payload }) => {
await step.email("send-email", async () => {
console.log("done");
return {
subject: `Welcome to Acme.`,
body: "We look forward to helping you achieve mission.",
};
});
},
{
// payloadSchema: z.object({}),
},
);

console.log(
await myWorkflow
.trigger({
payload: {},
})
.catch((e) => {
console.log(e);
}),
);
const myWorkflow = workflow(
"new-signup",
async ({ step, payload }) => {
await step.email("send-email", async () => {
console.log("done");
return {
subject: `Welcome to Acme.`,
body: "We look forward to helping you achieve mission.",
};
});
},
{
// payloadSchema: z.object({}),
},
);

console.log(
await myWorkflow
.trigger({
payload: {},
})
.catch((e) => {
console.log(e);
}),
);
I get a 422 error. message: workflow not found env:
NOVU_API_KEY=
NOVU_SECRET_KEY=
NEXT_PUBLIC_NOVU_UID=
NEXT_PUBLIC_NOVU_BACKEND_URL=https://api.novu.co
NEXT_PUBLIC_NOVU_SOCKET_URL=https://ws.novu.co
NOVU_API_KEY=
NOVU_SECRET_KEY=
NEXT_PUBLIC_NOVU_UID=
NEXT_PUBLIC_NOVU_BACKEND_URL=https://api.novu.co
NEXT_PUBLIC_NOVU_SOCKET_URL=https://ws.novu.co
2 Replies
Pawan Jain
Pawan Jain4mo ago
@abellaismail We have not added support of myWorkflow.trigger() Are you triggerign this workflow using nodejs sdk? Did you sync the worklfow from localstudio?
abellaismail
abellaismailOP4mo ago
I am using the self hosted solution I guess I will not be able to sync it
Want results from more Discord servers?
Add your server