Closed DuCanhGH closed 2 years ago
Hi @DuCanhGH
thanks a lot for reporting this quickly. I will create a fix today for this and release a 0.7.1
. I knew that something would break there eventually, with all the changes to middleware :D.
But it's stable since 12.2, so I think breaking changes like this won't happen anymore
@nibtime nice, thanks for the quick response :D
Hi @DuCanhGH @philhack
thought this was a 15min fix, turned out to be 15h 😁. It turns out that middleware now runs on any requests, so I had to provide some additional abstractions and do an internal redesign without req.page.name
(there seems no new equivalent).
I just released 0.8.0
with updated README to NPM
Cheers, and thank for reporting this bug!
@nibtime nice! Gotta test it tomorrow :D
@all-contributors add @DuCanhGH for bug
@nibtime
I've put up a pull request to add @DuCanhGH! :tada:
So I just upgraded my dependencies and that includes updating Next to 12.2 and next-safe/middleware to 0.7.0. I also moved to the new middleware
csp
and getCspInitialProps and moved pages/_middleware.ts to root folder and renamed it to middleware.ts. I thought it'd work, however, what I got wasIt turns out that req.page has been deprecated, but this middleware is still using it in middleware/strictDynamic.ts, or precisely, middleware/utils.ts/fetchHashes. For script-src, I got
'strict-dynamic' https: 'unsafe-inline'
, so it would have broken my whole app had it not been set to report-only :( I hope this will be fixed soon, thanks :D Source: https://github.com/DuCanhGH/react-18-nextjs/blob/fc713ac116b9aa8cfdc9649ea03a2ff6eace42bb/middleware.ts Page: https://react-18-nextjs.vercel.app/