SvelteKit form action stops working after 24 hrs. with ISR on Vercel
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
I have a somewhat simple contact form that stops working somewhere around 24 hours after being deployed. After it stops working, it will act like it's working from the browser perspective by immediately showing a successful response (faster than usual) but no email will be sent and all the console.log()s that should show up will not appear in Vercel's deployment logs.
I'm using SvelteKit's form action to process submissions via Superforms w/ Zod for validation, Recaptcha V3 for bot filtration, and Nodemailer + an SMTP server for email delivery. I also have ISR enabled with expiration set to never.
The main culprit appears to be ISR, because if I disable it by removing the config in page.server.ts, the form continues to work beyond one day. Am I not supposed to use server-side form actions with ISR? I didn't see anything about that in the docs. I prefer having the page pre-render via ISR because I do have a little bit of content that pulls from Sanity that will rarely change, if ever, that I don't want to be refetched all the time.
Reproduction
I made a simplified reproduction repo on GitLab, you just need to provide vercel the environment variables listed in dev.env (values not provided) and deploy/preview build it on Vercel. As mentioned, it will work perfectly for about the first 24 hours, then it fails to function while showing the success message in the browser.
Logs
Apr 23 22:33:33.02 200 | form-example-mauve.vercel.app | GET | /__data.json
Apr 23 22:33:32.93 200 | form-example-mauve.vercel.app | POST | /
Expected (when working):
Apr 23 22:51:29.50 | 200 | form-example-mauve.vercel.app | GET | /__data.json
Apr 23 22:51:29.43 | xxx | form-example-mauve.vercel.app | POST | /
Sucessful form submission: { accepted: [ '█████@█████.██' ], rejected: [], ehlo: [ 'SIZE 78643200', '8BITMIME', 'PIPELINING', 'PIPECONNECT', 'AUTH PLAIN LOGIN', 'HELP' ], envelopeTime: 63, messageTime: 46, messageSize: 1065, response: '250 OK id=1rzSjJ-00047q-1C', envelope: { from: '█████@█████.██', to: [ '█████@█████.██' ] }, messageId: '<22a2efb5-5f4c-932c-d3c5-739773a4d8c8@█████>' }
Apr 23 22:51:28.93 | xxx | form-example-mauve.vercel.app | POST | /
received form submission: { id: '1wasqpd', valid: true, posted: true, errors: {}, data: { FullName: 'Fake Name', CompanyName: undefined, Phone: '0000000000', Email: 'fake@email.address', Message: 'Test.' } }
Apr 23 22:51:28.01 | 200 | form-example-mauve.vercel.app | POST | /
System Info
System:
OS: Windows 11 10.0.22621
CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Memory: 5.94 GB / 15.86 GB
Binaries:
Node: 20.12.2 - D:\KC\programs\scoop\apps\nvs\current\nodejs\default\node.EXE
npm: 10.5.0 - D:\KC\programs\scoop\apps\nvs\current\nodejs\default\npm.CMD
pnpm: 9.0.5 - D:\KC\programs\scoop\apps\nvs\current\nodejs\default\pnpm.CMD
Browsers:
Chrome: 124.0.6367.62
Edge: Chromium (122.0.2365.92)
Internet Explorer: 11.0.22621.1
npmPackages:
@sveltejs/adapter-vercel: ^5.3.0 => 5.3.0
@sveltejs/kit: ^2.0.0 => 2.5.7
@sveltejs/vite-plugin-svelte: ^3.0.0 => 3.1.0
svelte: ^4.2.7 => 4.2.15
vite: ^5.0.3 => 5.2.10
Severity
serious, but I can work around it
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked GitLab reproduction and its page.server.ts ISR configuration, then compare deployments with ISR enabled and disabled on Vercel. Trace the form action alongside the /__data.json and POST logs around the 24-hour failure; done means submissions still reach the action and send email after that interval.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend, cloud, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100