Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix(docs): stop reporting guide 404s to Sentry, redirect missing paths (#50279)

Miranda Limonczenko86f3a9839920
diff --git a/apps/docs/features/docs/GuidesMdx.utils.tsx b/apps/docs/features/docs/GuidesMdx.utils.tsx
index 0212f9886a9..733d581537c 100644
--- a/apps/docs/features/docs/GuidesMdx.utils.tsx
+++ b/apps/docs/features/docs/GuidesMdx.utils.tsx
@@ -90,7 +90,12 @@ const getGuidesMarkdownInternal = async (slug: string[]) => {
editLink,
}
} catch (error: unknown) {
- if (error instanceof Error && error.cause instanceof FileNotFoundError) {
+ // `fromFs` rethrows FileNotFoundError directly, so check the error itself
+ // as well as its cause.
+ if (
+ error instanceof FileNotFoundError ||
+ (error instanceof Error && error.cause instanceof FileNotFoundError)
+ ) {
// Not using console.error because this includes pages that are genuine
// 404s and clutters up the logs
console.log('Could not read Markdown at path: %s', fullPath)
diff --git a/apps/docs/sentry.server.config.ts b/apps/docs/sentry.server.config.ts
index b8764647d2c..6f7b737527e 100644
--- a/apps/docs/sentry.server.config.ts
+++ b/apps/docs/sentry.server.config.ts
@@ -3,6 +3,7 @@
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from '@sentry/nextjs'
+
import { IS_DEV } from './lib/constants'
if (!IS_DEV) {
@@ -11,5 +12,11 @@ if (!IS_DEV) {
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
+
+ ignoreErrors: [
+ // A missing MDX file is a 404, not an error. Requests for guide paths
+ // that don't exist are ordinary crawler and inbound-link traffic.
+ /^FileNotFound:/,
+ ],
})
}
diff --git a/apps/www/lib/redirects.js b/apps/www/lib/redirects.js
index f04804216b9..ce4e019f7d1 100644
--- a/apps/www/lib/redirects.js
+++ b/apps/www/lib/redirects.js
@@ -105,6 +105,56 @@ module.exports = [
source: '/docs/guides/storage/uploads',
destination: '/docs/guides/storage/uploads/standard-uploads',
},
+ {
+ permanent: true,
+ source: '/docs/guides/storage/security',
+ destination: '/docs/guides/storage/security/ownership',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/serving',
+ destination: '/docs/guides/storage/serving/downloads',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/management',
+ destination: '/docs/guides/storage/management/copy-move-objects',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/s3',
+ destination: '/docs/guides/storage/s3/authentication',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/debugging',
+ destination: '/docs/guides/storage/debugging/logs',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/schema',
+ destination: '/docs/guides/storage/schema/design',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/production',
+ destination: '/docs/guides/storage/production/scaling',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/vector',
+ destination: '/docs/guides/storage/vector/introduction',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/storage/analytics/examples',
+ destination: '/docs/guides/storage/analytics/examples/duckdb',
+ },
+ {
+ permanent: true,
+ source: '/docs/guides/database/postgrest',
+ destination: '/docs/guides/api',
+ },
{
permanent: true,
source: '/docs/guides/storage/image-transformations',
@@ -113,7 +163,7 @@ module.exports = [
{
permanent: true,
source: '/docs/guides/storage/access-control',
- destination: 'docs/guides/storage/security/access-control',
+ destination: '/docs/guides/storage/security/access-control',
},
{
permanent: true,