Open gerdazk opened 2 years ago
I am also receiving these errors. Certain utm_content parameter values are blocked by Adblock Plus. This is only happening on dynamic pages as the add blocker is blocking the additional fetch for page data as the tracking parameters are present on the path.
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
Binaries:
Node: 14.18.2
npm: 6.14.15
Yarn: 1.22.19
pnpm: N/A
Relevant packages:
next: 12.2.4
eslint-config-next: 11.1.0
react: 17.0.2
react-dom: 17.0.2
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome 104.0.0.0
How are you deploying your application? (if relevant)
No response
Describe the Bug
Nextjs app breaks when i use middleware + ad-blocker
I have added
middleware.ts
file to a new nextjs project. When I use ad-blocker and visit url with adgroupid in the params (e.g. http://localhost:3000/test?id=9&adgroupid=292929), I get 500 error and app crashes.Everything works fine when ad-blocker is not used.
Ad-blockers that i have used: Adblock-plus
Ublock
Expected Behavior
App does not crash and content is displayed
If I visit website with adgroupid in parameters (http://localhost:3000/test?id=9&adgroupid=292929), do not add middleware and use ad-blocker, I can see in the console that some requests are blocked, but it does not cause 500 error and my app is still displayed. This would be the expected behaviour with middleware used as well.
Link to reproduction
https://github.com/gerdazk/nextjs-middleware-bug
To Reproduce
Clone the repository Run
yarn install
Runyarn dev
Visit http://localhost:3000/test?id=9&adgroupid=292929 'Failed to fetch' error should show up.Or:
Clone the repository Run
yarn install
Runyarn build
Runyarn start
Visit http://localhost:3000/test?id=9&adgroupid=292929 'Internal server error' message should show up