Skip to content

Dev server broken with @tanstack/solid-start and @cloudflare/vite-plugin #5338

Closed

Description

@HoaX7

Which project does this relate to?

Tanstack Start / Router

Describe the bug

Im unable to start the dev server with Tanstack Solid Start and Cloudflare. The app crashes with the error Error: getContextId cannot be used under non-hydrating context.

PS: The app runs without issues when deployed on cloudflare workers.

Your Example Website or App

https://github.com/HoaX7/focusroom

Steps to Reproduce the Bug or Issue

  1. Clone repository git clone https://github.com/HoaX7/focusroom
  2. cd focusroom
  3. pnpm install
  4. pnpm dev

Expected behavior

I expect the dev server to start.

Screenshots or Videos

Image

Platform

  • Router / Start Version: 1.132.23
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 139.0.7258.139
  • Bundler: vite
  • Bundler Version: 7.1.7

Additional context

vite.config.ts

import tsConfigPaths from "vite-tsconfig-paths";
import { defineConfig } from "vite";
import { tanstackStart } from "@tanstack/solid-start/plugin/vite";
import { cloudflare } from '@cloudflare/vite-plugin'
import viteSolid from "vite-plugin-solid";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
    server: {
        port: 3000,
    },
    plugins: [
    {
      // cloudflare workaround for dev
      name: "remove-ssr-external",
      configResolved(config) {
        config.environments.ssr.resolve.external = [];
      },
    },
    cloudflare({
      viteEnvironment: { name: "ssr" }
    }),
        tsConfigPaths(),
        tanstackStart({
            srcDirectory: "src",
      server: {
        entry: "src/server.ts",
      },
      client: {
        entry: "src/client.tsx",
      }
        }),
        // solid's vite plugin must come after start's vite plugin
        viteSolid({ ssr: true }),
        tailwindcss(),
    ],
});

Activity

  1. jperasmus commented on Oct 7, 2025

    @jperasmus
    Contributor

    Try removing https://github.com/HoaX7/focusroom/blob/main/src/lib/bindings.ts in favour of simply using `import { env } from "cloudflare:workers". The CF vite plugin should handle bindings for you.

  2. HoaX7 commented on Oct 8, 2025

    @HoaX7
    Author

    @jperasmus yes I did remove it but that isn't the problem. The dev env isn't starting at all. Anyway I switched to using react.

  3. brenelz commented on Oct 21, 2025

    @brenelz
    Contributor

    We've made quite a few improvements to Tanstack Solid Start as well as support for the cloudflare vite plugin. Could you check if upgrading solves your issues? Here is an example you can follow

    https://github.com/TanStack/router/tree/main/examples/solid/start-basic-cloudflare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions