Skip to content

bug: Type Instantiation is excessively deep Error when Defining a Job schema with eventTrigger #487

@Slyracoon23

Description

@Slyracoon23

Provide environment information

System:
OS: Linux 6.1 Manjaro Linux
CPU: (16) x64 Intel(R) Core(TM) i7-10870H CPU @ 2.20GHz
Memory: 20.98 GB / 31.13 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 20.5.1 - ~/.nvm/versions/node/v20.5.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v20.5.1/bin/yarn
npm: 9.8.0 - ~/.nvm/versions/node/v20.5.1/bin/npm

Describe the bug

Description

While implementing a job that fetches and stores Discourse posts using the Trigger.dev SDK and Supabase, I encountered a TypeScript error: "Type instantiation is excessively deep and possibly infinite (ts2589)".

The error occurs when defining the eventTrigger as shown below:

client.defineJob({
  id: "discourse-example-job",
  name: "Fetch and Store Discourse Posts",
  version: "0.0.1",
  trigger: eventTrigger({
    name: "supabase.fetch-data",
    schema: z.object({
      org_id: z.string(),
      base_discourse_url: z.string(),
    }),
  }),
  // ... (rest of the code)
});

Error Message

Type instantiation is excessively deep and possibly infinite.ts(2589)

Reproduction repo

Private Repo

To reproduce

Steps to Reproduce

  1. Define a job using client.defineJob
  2. Inside the eventTrigger method, define a z.object schema with the properties as shown above.
  3. Upon doing so, the TypeScript error appears.

Expected Behavior

I expect to be able to define the job's trigger with eventTrigger and the z.object schema without encountering a TypeScript error.

Additional information

Additional Information

"@trigger.dev/nextjs": "^2.0.14",
"@trigger.dev/react": "^2.1.0",
"@trigger.dev/sdk": "^2.0.14",
"@trigger.dev/supabase": "^2.0.14",

Node version: v20.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/integrationsarea/serverIssues related to the Trigger.dev serverbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions