Skip to content

[Bug?]: nitroV2Plugin doesn't generate a valid output with Cloudflare presets #2115

@dario-piotrowicz

Description

@dario-piotrowicz

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When using the "@solidjs/vite-plugin-nitro-2" plugin Cloudflare presets (like cloudflare-module) don't generate a functioning application.

They generate an application that when run via npx wrangler dev returns a 500 response:
screenshot of 500 response from browser

Note that using directly the nitro plugin from "nitro/vite" does instead.

Expected behavior 🤔

The "@solidjs/vite-plugin-nitro-2" plugin would produce valid Cloudflare Workers in the same way the official nitro plugin does. (especially since the "@solidjs/vite-plugin-nitro-2"plugin does accept apreset` in its options parameter).

Steps to reproduce 🕹

Steps:

  1. Create a new solid-start app via npm create solid, select:
    (the options not listed are not relevant)
    • ◇ What type of project would you like to create?
      │ SolidStart
    • ◇ Which version of SolidStart?
      │ v2 (pre-release, recommended)
    • ◇ Which template would you like to use?
      │ basic
  2. cd into the project's directory, run npm i
  3. in the /vite.config.ts file add the cloudflare-module preset to the nitro plugin:
    import { defineConfig } from "vite";
    import { nitroV2Plugin as nitro } from "@solidjs/vite-plugin-nitro-2";
    
    import { solidStart } from "@solidjs/start/config";
    
    export default defineConfig({
     plugins: [solidStart(),
    -   nitro()
    +   nitro({ preset: 'cloudflare-module' })
     ]
    });
  4. run npm run build
  5. run npx wrangler dev .output/server/index.mjs --assets .output/public (as suggested by the npm run build output)
  6. Try visiting the page and it won't work

Context 🔦

At Cloudflare we have the create-cloudflare CLI npm create cloudflare which scaffolds projects for users. It supports most frameworks including solidStart, however we noticed that recently, after solid switched to the @solidjs/vite-plugin-nitro-2 plugin, the solidStart integration of create-cloudflare broke and we would love it if we could fix it. I'm happy to try to help with whatever fix might be necessary here 🙂 (I don't have a lot of context and I don't really know what the switch was made from the official nitro plugin to the solid specific one).

But note that this issue is valid regardless on create-cloudflare. As far as I can tell, the use of the new solid specific plugin prevents the deployment of any solidStart applications to Cloudflare.

Your environment 🌎

System:
    OS: macOS 26.3.1
    CPU: (10) arm64 Apple M1 Pro
Binaries:
    Node: 22.21.1
    Yarn: 1.22.22
    npm: 10.9.4
    pnpm: 10.30.2
npmPackages:
   @solidjs/start: 2.0.0-alpha.2
   @solidjs/vite-plugin-nitro-2: 0.1.0
   (nitro: 3.0.260311-beta)

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.xtargeting SolidStart 2.x versionsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions