Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Payments and webhooks

A Stripe webhook to a Vercel function fails with a 308 redirect

Error(308) ERR in the Stripe webhook delivery list

Short answer

Stripe treats every redirect from a webhook URL as a failure and does not follow it. A 308 on Vercel is a permanent redirect, most often from a trailing-slash rule, a redirects entry in vercel.json, or a domain redirect between apex and www. Find the Location header with curl, then register that final URL in Stripe.

  • Applies to Vercel platform 2026, Next.js 15 and 16, Stripe API 2026-10-28, curl
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Send a POST to the exact URL that is registered in Stripe, and read the status line and the Location header. The Location is where Vercel wants the request to go.

    curl -i -X POST https://example.com/api/webhooks/stripe -H "Content-Type: application/json" -d '{}'
  2. 2Match what you see, then jump to its fix

    1. 1Location is your URL with a slash added or removed at the end.A trailing slash rule redirects your URLFix
    2. 2Location points to a different path, and vercel.json has a redirects entry that matches.A redirects rule in vercel.json matches the webhook pathFix
    3. 3Location has a different host: the www name instead of the apex, or the reverse.The webhook uses a domain that redirects to anotherFix

What does the error look like?

  • (308) ERR in the Stripe webhook delivery list
  • HTTP/2 308

Cause 1 of 3

A trailing slash rule redirects your URL

1Check

In Next.js, URLs with a trailing slash redirect to the version without it by default, and trailingSlash: true reverses that. On Vercel, trailingSlash in vercel.json does the same with a 308: true redirects /path to /path/, false redirects /path/ to /path.

grep -rn "trailingSlash" next.config.* vercel.json

2Fix

Register the webhook URL in exactly the form the app serves, with no redirect. If the project uses trailingSlash: true, add the slash to the URL in Stripe; if not, remove it.

// next.config.js
module.exports = { trailingSlash: false }
// Stripe endpoint: https://example.com/api/webhooks/stripe

3Verify

The POST returns the handler's status, not 308.

curl -i -X POST https://example.com/api/webhooks/stripe -d '{}'

Confirmed by vercel.com

Did this fix it?

Cause 2 of 3

A redirects rule in vercel.json matches the webhook path

1Check

Vercel redirects are permanent by default, and the status code is 308 when permanent is true. A broad source pattern can catch the webhook path.

grep -n "redirects" -A8 vercel.json

2Fix

Narrow or remove the rule so the webhook path is not matched.

{
  "redirects": [
    { "source": "/blog/:path*", "destination": "/news/:path*" }
  ]
}

3Verify

Redeploy and repeat the first-step command.

curl -i -X POST https://example.com/api/webhooks/stripe -d '{}'

Confirmed by vercel.com

Did this fix it?

Cause 3 of 3

The webhook uses a domain that redirects to another

1Check

Vercel domains can redirect one domain to another, for example www to the apex, and Vercel attempts a redirect between the www and non-www name automatically. Stripe's endpoint URL then points at the domain that redirects.

curl -sI https://www.example.com/api/webhooks/stripe | grep -i "^location"

2Fix

Change the endpoint URL in Stripe to the domain the redirect leads to (Stripe's guidance for any 3xx: set the endpoint to the URL resolved by the redirect). Do not turn the redirect off for the whole site.

# Stripe Dashboard > Webhooks > endpoint URL
https://example.com/api/webhooks/stripe

3Verify

Resend a failed event from the Dashboard; the delivery shows 200.

stripe events resend EVENT_ID --webhook-endpoint=WEBHOOK_ENDPOINT_ID

Confirmed by vercel.com

Did this fix it?

How do I stop it coming back?

  • Register the webhook with the final canonical URL, and keep trailing-slash settings the same on every environment.
  • Test the endpoint with curl -i -X POST after every deploy that touches redirects.
  • Return a 2xx quickly from the handler and do slow work after the response.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Payments

Stripe Elements shows console warnings or errors in a Next.js checkout

Could not find Elements context; You need to wrap the part of your app that calls useElements() in an <Elements> provider.

Most React Stripe.js warnings come from four mistakes: calling loadStripe inside a component, using useStripe or useElements outside the Elements provider, using the objects before they have loaded, and a Content Security Policy that blocks js.stripe.com.

4 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.