Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SvelteKit form action stops working after 24 hrs. with ISR on Vercel #12158

Open
apokaliptis opened this issue Apr 24, 2024 · 0 comments
Open

Comments

@apokaliptis
Copy link

apokaliptis commented Apr 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant