fix: add CF function for edge level deprecation#641
Conversation
✅ Deploy Preview for staging-my ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughA middleware function is added to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @functions/_middleware.js:
- Around line 7-16: The Response currently sets only 'Cache-Control: no-store'
which may not be honored by some CDNs/proxies; update the headers in the
Response creation (the Response return in _middleware.js) to use a stricter
cache policy such as adding 'Cache-Control: no-store, no-cache, must-revalidate,
max-age=0' and also add a CDN/proxy-focused header like 'Surrogate-Control:
no-store' (or your CDN's recommended header) to ensure edge caches don't retain
the 410 response.
- Line 19: Update the middleware to await the downstream handler by changing the
final statement from `return next()` to `return await next()` so any future
try/catch or cleanup around the call can properly observe rejections; locate the
return in the middleware function (the `return next()` statement) in
functions/_middleware.js and replace it with `return await next()`.
- Around line 2-5: The IS_DEPRECATED logic currently treats any undefined or
non-'false' value as deprecated; change it to default to not deprecated by
guarding against a missing context.env and normalizing the value before
comparison: read context.env (ensure it's not undefined), convert
context.env.DEPRECATED to a string, trim and toLowerCase it, and set
IS_DEPRECATED to true only when that normalized string equals 'true' (otherwise
false). Use the existing symbol names (context, env, IS_DEPRECATED,
env.DEPRECATED) so the change is localized and clear.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
functions/_middleware.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build (16.x)
Date: 11-01-26
Developer Name: @MayankBansal12
Issue Ticket Number
Description
DEPRECATEDflag for easy rollback when set to 'false'Tech Doc Link
https://docs.google.com/document/d/1XAb4T6GxCciZSPbO_ji1-cqnsOiwH3vFH2V6wJFhB9Y/
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
working proof
Deployed a version of website my to test the changes
Screencast.from.2026-01-13.20-35-59.mp4