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

Named form actions do not work with Vercel ISR. #11337

Open
Leftium opened this issue Dec 15, 2023 · 3 comments
Open

Named form actions do not work with Vercel ISR. #11337

Leftium opened this issue Dec 15, 2023 · 3 comments
Labels
pkg:adapter-vercel Pertaining to the Vercel adapter

Comments

@Leftium
Copy link

Leftium commented Dec 15, 2023

Describe the bug

A named form action returns a 500 Internal Error when served from Vercel with ISR.

Reproduction

Steps:

  1. Clone repo: https://github.com/Leftium/kit-demos/tree/isr-actions
  2. Deploy to Vercel
  3. Load / (root path): https://kit-demos-git-isr-actions-leftium.vercel.app/
  4. Click "Submit" button

Expected:

  • "undefined" turns to "true" (the property form.success from return value of form action.)

Actual:

  • 500 Internal Error
  • Vercel log may show error message like "cannot find default form action."

Logs

No response

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 8.99 GB / 23.86 GB
  Binaries:
    Node: 18.18.2 - V:\scoop\apps\nodejs-lts\current\node.EXE
    npm: 9.8.1 - V:\scoop\apps\nodejs-lts\current\npm.CMD
    pnpm: 8.11.0 - V:\pnpm-home\pnpm.CMD
  Browsers:
    Edge: Chromium (120.0.2210.61)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.1.1
    @sveltejs/kit: ^1.20.4 => 1.30.3
    svelte: ^4.0.5 => 4.2.8
    vite: ^4.4.2 => 4.5.1

Severity

serious, but I can work around it

Additional Information

So the work-arounds are to not use named form actions or not use ISR.

@carstenjaksch
Copy link

carstenjaksch commented Dec 26, 2023

I have the same issue, but with ISR and Speed-Insights (also from Vercel) producing the same error message.

Discussion: https://github.com/orgs/vercel/discussions/4460

Can confirm that disabling both Vercel features fixes these issues and my named action works as expected.

@leoj3n
Copy link
Contributor

leoj3n commented Mar 24, 2024

I believe I am hitting this same issue seeing as a form that previously worked on hitting "save" now says "404 Not Found" upon hitting "save" after enabling ISR in a root-level +layout.server.js that affected that route.

I mean this kind of makes sense though, and I think the ISR docs just need to specifically point out that when you enable ISR for any given route(s), those routes are going to be processed as though prerender is set to true (else ISR would not really do anything for that route). I have added a note or two along these lines in PR #12030

I am assuming my assumptions here are correct about ISR turning a route essentially into a prerendered route and thus causing server-side functions to no longer fire, although I am not 100% certain I am correct in my way of explaining it.

@leoj3n
Copy link
Contributor

leoj3n commented Mar 24, 2024

After seeing #661 (comment) I am wondering if my initial interpretation above is accurate.

@eltigerchino eltigerchino added the pkg:adapter-vercel Pertaining to the Vercel adapter label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:adapter-vercel Pertaining to the Vercel adapter
Projects
None yet
Development

No branches or pull requests

4 participants