inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
414 stars 41 forks source link

Add logger parameter to onFailure #279

Closed aabedraba closed 1 year ago

aabedraba commented 1 year ago

With normal functions I'm using the logger this way:

 async ({ event, step, logger }) => {
    await step.run("Trigger task", async () => {
      try {
        return await task()
      } catch (err) {
        logger.error("Step Trigger upload event failed: ", {
          userId: event.data.userId
        });
        throw err;
      }
    });
}

Nevertheless, I don't get a logger on the onFailure section as it's not available, so I would need to do my error handling differently in different places, which is not ideal.

Is there a reason it was designed this way? Would be great to have it!

jpwilliams commented 1 year ago

Thanks for catching this, @aabedraba! Will be fixed in the next release: