[BUG] fetch() causes "We detected that you have multiple steps with the same ID."
Describe the bug
The Inngest TypeScript SDK provides a step.fetch() API and a fetch() utility, enabling you to make requests to third-party APIs. However, multiple fetch() steps to the same hostname cause "We detected that you have multiple steps with the same ID." even if the requests have different headers or payload.
To Reproduce Steps to reproduce the behavior:
- Create a service with can send requests to an external endpoint using
fetchorstep.fetch - Create an inngest function that will execute the fetch multiple times with different header or payload parameters (eg. an inngestion function that loops over all pages of a external API)
- Invoke the function as see that the warnings appears locally and the function doesn't run successfully when deployed in production
=================================================
⚠️ We detected that you have multiple steps with the same ID.
Your function is still running, though it may exhibit unexpected behaviour. This can happen if you're using the same ID for multiple steps across different chains of parallel work. We found the issue with step "step.fetch: sentry.io". Using the same IDs across parallel chains of work can cause unexpected behaviour.
We recommend using a unique ID for each step, especially those happening in parallel.
Code: AUTOMATIC_PARALLEL_INDEXING
=================================================
Expected behavior I would expect the framework to either:
- Make the step.id unique for different fetch options
- Or provide devs with a way to override the step id for a
step.fetch
Code snippets / Logs / Screenshots Here's a simple example to reproduce
inngest.createFunction(
{ id: "my-fn" },
{ event: "product/activated" },
async ({ step }) => {
let page = 1;
let hasMore = true;
let allProducts: Product[] = [];
const api = new MyProductApi({ fetch: step.fetch });
// Define a simple loop that fetches multiple pages of data
while (hasMore) {
const { data, nextPage } = await api.listProducts(page);
allProducts.push(...data);
hasMore = nextPage !== null;
page = nextPage;
}
},
);
System info (please complete the following information):
- OS: Mac
- npm package version
inngest3.39.2 - Framework Next.js
- Platform Vercel
Additional context Links to Inngest docs used to create this edge case https://www.inngest.com/docs/guides/working-with-loops#loop-example https://www.inngest.com/docs/features/inngest-functions/steps-workflows/fetch
We are also experiencing this. Have you found any solution for it?