The debug logs show URL differences (vm-p8 vs v0-th) which is expected in a sandbox. The real issue is that I need to verify the API route is working correctly. Let me check the actual implementation and ensure the Supabase client is properly configured to generate signed URLs. I'll also check if there are any environment variables missing:
Good news—the API route code looks correct and all Supabase environment variables are set. The issue is likely that the actual file paths in the Supabase bucket don't match exactly what's in the FILE_MAPPINGS. I need to verify the exact file paths in your album bucket. Can you provide the exact directory structure and file names in your Supabase storage bucket under the "album" bucket?
For example, I need to confirm:
tracks/ subfolder?code_33.mp3, coded-talk.mp3, etc.?WakeUp_Phase1_Initiation.zip and WakeUp_Phase2_Revelation.zip?Once you confirm the exact file paths/names in your Supabase album bucket, I can update the FILE_MAPPINGS to match perfectly and test the API route.
Now I can see the issue. The API route has file paths with tracks/ prefix, but according to your structure, the files are directly in the tracks bucket (not in a subfolder). Also, I need to handle different buckets for different file types. Let me fix the API route to use the correct bucket names and file paths:
Now I'll update the download page to show the correct message based on whether it's a single track or full album phase:
I've updated both files:
API Route Updates (/api/download/route.ts):
tracks/ bucket for individual MP3 files and album/ bucket for ZIP filescode_33.mp3 directly in tracks bucket, not tracks/code_33.mp3)type field ("track" or "album") to help the frontend display the correct messageDownload Page Updates (/download/page.tsx):
TRACK_INFO from the API route instead of maintaining a duplicate mappingDynamically shows different download text based on file type:
TRACK_INFO objectThe API route now generates signed URLs directly from the correct private Supabase buckets, and the download page displays contextual messaging based on what the user purchased.
The runtime errors show that the Stripe success URLs are using the wrong hostname (vm-p8 instead of v0-th). This is because window.location.origin in the sandbox environment returns the temporary preview URL instead of the production domain. I need to fix the getStripeCheckoutUrl helper function to use the correct hardcoded production domain.
Fixed! I simplified the getStripeCheckoutUrl helper function to use the hardcoded production domain https://v0-thehiddenprotocol.vercel.app instead of relying on window.location.origin, which was returning the temporary preview URL (vm-p8...) in the sandbox environment. Now all Stripe checkout links will include the correct success and cancel URLs that redirect users to the right domain after payment.
An error occurred during deployment. Please fix:
Running build in Washington, D.C., USA (East) – iad1
Build machine configuration: 2 cores, 8 GB
Retrieving list of deployment files...
Downloading 86 deployment files...
Restored build cache from previous deployment (E851GLkuUoXSvLpnUiKdusTQhDbj)
...
at <unknown> (./app/download/page.tsx:5:20)
at <unknown> (./app/download/page.tsx:6:10)
at <unknown> (./app/download/page.tsx:5:10)
ELIFECYCLE Command failed with exit code 1.
Error: Command "pnpm run build" exited with 1
You can send messages while the preview loads