solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: Server action chunks are not generated in production build when using `experimental.islands`

Open jtag05 opened this issue 1 year ago • 3 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Current behavior 😯

Triggering a server action from a production build when experimental.islands are enabled throws a 500 error Cannot find module for the referenced chunk.

Expected behavior 🤔

Server actions should behave as they do in development as well as a production build with islands disabled.

Steps to reproduce 🕹

minimum repro repository

Steps:

  1. Clone linked repo
  2. Run pnpm build
  3. Run pnpm start
  4. Open app and click Trigger Action button
  5. Observer the 500 error indicating that the server action chunk does not exist.

Context 🔦

I tried debugging this locally and the issue seems related to these lines in the vinxi config. Removing the both conditionals for the islands feature re-adds the server functions, but re-adds the client side routing, obviously. Having either of the two conditionals results in the server actions chunk not being generated.

https://github.com/solidjs/solid-start/blob/main/packages/start/config/index.js#L154-L159 https://github.com/solidjs/solid-start/blob/main/packages/start/config/index.js#L192-L196

I will continue to poke around and see if I can solve this but I am not deeply familiar with vinxi or vite apart from a surface level understanding. I do find it odd that the client config is dictating if server actions are being generated though :thinking:

Your environment 🌎

System:
  OS:  Linux 6.5.0-35-generic Ubuntu 22.04.4 LTS
  CPU: i7-9750H 
Binaries:
  Node: v20.10.0
  pnpm: v9.4.0
npmPackages:
  @solidjs/router: 0.13.6
  @solidjs/start: 1.0.2
  solid-js: 1.8.17
  vinxi: 0.3.12

jtag05 avatar Jun 24 '24 01:06 jtag05

I think this is kinda expected that islands doesn't work as expected anymore since its experimental

brenelz avatar Jun 25 '24 00:06 brenelz

I understand that it is experimental and essentially in a preview mode. I was just logging the bug so it's a known issue. And if we could resolve it, all the better.

jtag05 avatar Jun 25 '24 11:06 jtag05

So the client config having an impact is a bit of a red herring. If we add start.experimental.islands ? serverComponents.server() : null to the server-fns plugins it resolves the issue without re-enabling the client side routing. I'll keep poking to make sure that all of the code in that function is required or if we could strip it down for the server functions in particular.

jtag05 avatar Jun 25 '24 12:06 jtag05

With the merged issue I'm gathering we can close this one for now until we find more issues.

ryansolid avatar Jul 16 '24 18:07 ryansolid

@ryansolid so I'm still seeing this now that it's merged and deployed. I finally got around to testing the release tonight. I'll keep tinkering and try and resolve it more concretely. It seems odd though, because it was definitely resolved with my changes locally when I opened that PR.

jtag05 avatar Jul 17 '24 02:07 jtag05