Next.js middleware not executing in monorepo

Hello!

I have an issue where our Next.js middleware is not executing. I am suspecting it is because we are using a monorepo (with turbo monorepo) and exporting a static site.

It works when running locally in next development and production mode.

Directory structure:

  • apps/my-app/{next.js-application}
  • apps/my-app/src/pages/_middleware.ts (not executing)

We are currently running Netlify and the builds and deployments work fine. I can send you the site id in PM.

Do you have an ideas on how to make it execute?

/Anders

Hey there, @a.sjogren :wave:

Thanks for reaching out about this! We would be happy to look into this further for you, but can you share a bit more information with us? I would ask that you dm @hrishikesh you site id and repo, then there is a chance we will be able to look into it further for you.

Once we have that information, all continued debugging will take place in this thread. This is because different staff members have rotating schedules, and we do not want interactions to get lost in messages.