TLDR
Just add /tunnel
or /monitoring
routes to your Next.js middleware matcher ignored list, these routes should be rewritten to Sentry’s service, don’t need to be handled by your Next.js middleware.
Sentry is a popular service used to monitor product errors, which Quotion is also using.
I build Quotion with Vercel Platforms Starter Kit, and Sentry works well with this shiny new technology. However, we encountered an HTTP 405 error on our production, like this:
I checked the Sentry docs, but nothing helped. One day, while searching for something inside the Next.js build output folder .next
, I found that the Sentry /tunnel
API is being used for rewriting to Sentry's API:
That's when I realized why this 405 error was occurring. Vercel Platforms Starter Kit rewrites almost everything to subfolders to create a multi-tenancy platform. Therefore, we need to bypass this special /tunnel
API in the Next.js middleware. Based on my middleware matcher configuration, I only need to change the Sentry configuration to **/api/tunnel**
. For example, this is my middleware configuration:
export const config = {
matcher: [
/*
* Match all paths except for:
* 1. /api/ routes
* 2. /_next/ (Next.js internals)
* 3. /images/ (static images)`
* 4. /_static (inside /public)
* 5. /_vercel (Vercel internals)
* 6. all root files inside /public (e.g. /favicon.ico)
*/
'/((?!api/|_next/|images/|_static|_vercel|[\\w-]+\\.\\w+).*)',
],
};
If you don't want to change the Sentry configuration, you can also add your Sentry API to the matcher RegExp:
export const config = {
matcher: [
// 👇
'/((?!api/|tunnel|_next/|images/|_static|_vercel|[\\w-]+\\.\\w+).*)',
],
};
engineering
nextjs
Create your blogs directly from Apple Notes.
Say goodbye to complex CMS updates and management issues!
You focus on creating quality content while Quotion takes care of the rest.
Latest
More from the blog
Qing
applenotes
How to share Apple Notes and collaborate with others
Did you know you can share your notes with other iCloud users in Apple Notes? Besides, you can also collaborate with others to work on the same notes, everyone can see each other's changes. Let me show you how. Prerequisite You need an iCloud account and have to be logged in to your Apple device
Read post
Qing
applenotes
How to undo in Apple Notes
I like Apple Notes, it's easy to use, fast, and robust for note taking. Sometimes, you may make mistakes when typing, there are some steps to help you undo changes on all Apple devices. On iPhone or iPad Since the iPad version has a similar layout and features as the iPhone version, we use the
Read post
Qing
applenotes
Comprehensive Guide to Apple Notes Not Syncing
Sometimes, you may find that Apple Notes isn't syncing for some reasons. For example, you have written some texts on your iPhone, but they didn't get synchronized to your Mac. This is an infamous issue that happened to iCloud. You can find many similar posts on the Apple forum: Notes Not Syncing Across Devices iPhone
Read post