Skip to content

inngest@3.35.0

Choose a tag to compare

@inngest-release-bot inngest-release-bot released this 10 Apr 22:14
· 375 commits to main since this release
ca2f276

Minor Changes

  • #912 a641cc2 Thanks @jpwilliams! - Adds a fetch export from "inngest" to allow any library that accepts a Fetch API-compatible function to automatically turn any call into a durable step if used within the context of an Inngest Function.

    By default, if called outside of the context of an Inngest Function (or within an existing step), it will fall back to using the global fetch, or a fallback of the user's choice.

    // Basic use
    import { fetch } from "inngest";
    
    const api = new MyProductApi({ fetch });
    // With a fallback
    import { fetch } from "inngest";
    
    const api = new MyProductApi({
      fetch: fetch.config({
        fallback: myCustomFetchFallback,
      }),
    });
    // Remove the default fallback and error if called outside an Inngest Function
    import { fetch } from "inngest";
    
    const api = new MyProductApi({
      fetch: fetch.config({
        fallback: undefined,
      }),
    });

    It's also available within a function as step.fetch.

    inngest.createFunction(
      {
        id: "my-fn",
      },
      {
        event: "my-event",
      },
      async ({ step }) => {
        const api = new MyProductApi({ fetch: step.fetch });
      },
    );