vercel / nextjs-subscription-payments

Clone, deploy, and fully customize a SaaS subscription application with Next.js.
https://subscription-payments.vercel.app/
MIT License
5.79k stars 1.19k forks source link

Fixes #269: Empty NEXT_PUBLIC_SITE_URL env var breaks checkout in local testing #270

Closed chriscarrollsmith closed 7 months ago

chriscarrollsmith commented 7 months ago

The example .env.local file contains this text:

# Update this with your stable site URL only for the production environment.
NEXT_PUBLIC_SITE_URL=

If the user leaves this variable empty rather than deleting it, the template fails to create a checkout session during local testing. That's because getURL in 'helpers.ts' is only using the localhost fallback when NEXT_PUBLIC_SITE_URL is non-existent, not when it's empty.

This PR adds logic to go to the localhost fallback when the variable is empty.

Fixes #269. Also closes #236.

vercel[bot] commented 7 months ago

@chriscarrollsmith is attempting to deploy a commit to the Vercel Solutions Team on Vercel.

A member of the Team first needs to authorize it.