Description
Describe the bug
When triggering an Inngest event, the function execution fails with a Zod validation error stating "Expected object, received string". The error occurs during the parseFnData step in the Inngest communication handler.
To Reproduce
Steps to reproduce the behavior:
- Set up Next.js application with Inngest integration
- Create and register Inngest functions
- Trigger an Inngest event (either manually or programmatically)
- Function execution fails with parsing error
Expected behavior
Inngest events should trigger successfully and functions should execute without parsing errors.
Screenshots / Stack trace dump
Failed to parse data from executor.
at prettyError (/Users/inioluwa/Code/kikin-finance/node_modules/inngest/helpers/errors.js:303:29)
at parseFailureErr (/Users/inioluwa/Code/kikin-finance/node_modules/inngest/helpers/functions.js:238:40)
at parseFnData (/Users/inioluwa/Code/kikin-finance/node_modules/inngest/helpers/functions.js:178:25)
at InngestCommHandler.runStep (/Users/inioluwa/Code/kikin-finance/node_modules/inngest/components/InngestCommHandler.js:864:64)
at InngestCommHandler.handleAction (/Users/inioluwa/Code/kikin-finance/node_modules/inngest/components/InngestCommHandler.js:642:50)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async ServerTiming.wrap (/Users/inioluwa/Code/kikin-finance/node_modules/inngest/helpers/ServerTiming.js:64:21)
at async ServerTiming.wrap (/Users/inioluwa/Code/kikin-finance/node_modules/inngest/helpers/ServerTiming.js:64:21)
at async /Users/inioluwa/Code/kikin-finance/node_modules/@sentry/nextjs/cjs/server/wrapApiHandlerWithSentry.js:144:33
[
{
"code": "invalid_type",
"expected": "object",
"received": "string",
"path": [],
"message": "Expected object, received string"
}
] Function execution can't continue.
Make sure that your API is set up to parse incoming request bodies as JSON, like body-parser for Express (https://expressjs.com/en/resources/middleware/body-parser.html).
System info
- inngest version: 3.22.13
- Next.js version: 13.4.1
- Node.js version: v22.13.0
- OS: macOS 15.5 (24F74)
Additional context
The error suggests that the Inngest library is receiving a string when it expects an object during the parsing phase. This could be related to how the request body is being processed in the Next.js API route or how the data is being serialized/deserialized between the Inngest dashboard and the application.