-
The recently released Next version 12.2.0 introduces several changes, including stable middleware. Among other things, the middleware limited possibility of returning a response body, which we need for processed sitemap. First error:
Second error:
More info about error: Returning response body in middleware We need to find a solution for this, in the meantime I suggest to update package.json in the examples to limit the maximum version to 12.1.6.
|
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
Hey @priard, Thanks for reporting the issue! Yes, with Next.js middleware now out of beta, they made some unexpected (imo) changes that effect how middleware work. The first issue with nested middleware is easy to solve from the sitemap perspective. But the lack of support for returning a response body will require some additional thought from how we want to support sitemaps going forward. We've created a ticket in our internal backlog (MERL-357) to address this. In the meantime, I agree we should limit the version in the example project's |
Beta Was this translation helpful? Give feedback.
-
Hey, is there anything new on the subject? |
Beta Was this translation helpful? Give feedback.
-
Hi @roeean, we are activately working on a solution for this in our current development sprint. |
Beta Was this translation helpful? Give feedback.
-
is there any update ? i am actively looking into this thread |
Beta Was this translation helpful? Give feedback.
-
Doing something like this as a quick hacky fix:
|
Beta Was this translation helpful? Give feedback.
-
Hello @priard. We've recently added a helper that overcomes this issue with next.js. Unfortunately we haven't documented this yet but its easy to use it. Here is how to enable this:
import {getSitemapProps} from '@faustjs/next/server';
export default function Page() {
return null;
}
export const getServerSideProps = async (ctx) => {
return getSitemapProps(ctx, {
frontendUrl: 'http://localhost:3000', // or your public frontend URL
wpUrl: process.env.NEXT_PUBLIC_WORDPRESS_URL,
sitemapIndexPath: '/wp-sitemap.xml' // path in WordPress that handles sitemaps
});
} Visit your page at I hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Hi, it really works great, thanks a lot! |
Beta Was this translation helpful? Give feedback.
Hello @priard. We've recently added a helper that overcomes this issue with next.js. Unfortunately we haven't documented this yet but its easy to use it.
Here is how to enable this:
Create a
sitemap.xml.ts
in thepages
directory:Create a page that handles the sitemap request:
Visit your …