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
371 stars 37 forks source link

[BUG] ingest-cli doesn't register / sync nextjs server locally #545

Open ziyaaktas opened 2 months ago

ziyaaktas commented 2 months ago

Describe the bug I have been going through the guides just to try out the ingest product. However I couldn't pass the syncing apps part.

To Reproduce Go through the https://www.inngest.com/docs/quick-start tutorial.

Expected behavior Local server syncs with nextjs

Code snippets / Logs / Screenshots route.ts

import { serve } from 'inngest/next';
import { inngest } from '@/utils/inngest/client';
import { getContractData } from '@/utils/inngest/functions';

// Create an API that serves zero functions
export const { GET, POST, PUT } = serve({
  client: inngest,
  functions: [
    getContractData,
    /* your functions will be passed here later! */
  ],
});

When I ping localhost:3000/api/inngest, I get this response {"message":"Inngest endpoint configured correctly.","hasEventKey":false,"hasSigningKey":false,"functionsFound":1,"mode":{"type":"dev","isExplicit":true}}

System info (please complete the following information):

Additional context Add any other context about the problem here.

image

linear[bot] commented 2 months ago

INN-2955 [BUG] ingest-cli doesn't register / sync nextjs server locally

chaejung-kim commented 1 month ago

Have you checked middleware.ts? I had the same issue locally. Then I figured out middleware.ts was bypassing all routes including api/inngest. So, I added api/inngest to the matcher.

export default auth((req) => { // some logic like authentication });

export const config = { matcher: ["/((?!_next|api/auth|logo.svg|favicon.ico).*)"], };


```typescript
// TO-BE
import { auth } from "@providers/auth";

export default auth((req) => {
  // some logic like authentication
});

export const config = {
  matcher: ["/((?!_next|api/auth|api/inngest|logo.svg|favicon.ico).*)"],
};