Skip to content

Investigate cloudflare support #18669

Description

@nicohrubec

At the moment we document and test only nitro. We should investigate whether our SDK works properly with Cloudflare and document what needs to be done to set this up. Ideally we add an E2E app to test this.

Activity

  1. self-assigned this
    on Jan 2, 2026
  2. linear commented on Jan 2, 2026

    @linear
  3. JPeer264 commented on Feb 27, 2026

    @JPeer264
    Member

    Some thoughts from my side.

    • Entrypoint: Cloudflare needs to have a wrapper around functions which are exported of the start.ts, there is no way around it
    • Entrypoint: We could theoretically add our own "entrypoint" like following and steer everything via environment variables:
      // wrangler.jsonc
      {
        "main": "@sentry/tanstackstart-react/cloudflare/server-entry"
      }
      That means that our entrypoint would just import @tanstack/react-start/server-entry, wrap everything and export it
    • Cloudflare can't have integrations with OpenTelemetry monkey patching, so we need to define which integrations are possible (this could even be a general Cloudflare SDK topic)
    • I'm currently not sure if it is possible to use Cloudflare specific handlers, such as queue (if so we need to see if we wrap the entrypoint with @sentry/tanstackstart-react or @sentry/cloudflare.
    • nodejs_compat is required in the compatibility settings
    • I wouldn't add support for legacy Cloudflare Pages with pages_build_output_dir in the wrangler.jsonc, as everything goes to Cloudflare Workers with its "assets"
  4. removed their assignment
    on Apr 21, 2026
  5. vmsp commented on Apr 27, 2026

    @vmsp

    Hey guys, I'd love for this to be supported. I'm running a TanStack Start (React) on Cloudflare. I have a custom entrypoint with fetch, queue and scheduled. My fetch has a bunch of logic and then ends up calling @tanstack/react-start/server-entry. I'd argue unobfuscating server functions (like you guys already do here:

    if (url.pathname.includes('_serverFn') || url.pathname.includes('createServerFn')) {
    ) is paramount. Let me know if I can provide any additional info. Thanks!

  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Apr 27, 2026
  7. JPeer264 commented on Apr 27, 2026

    @JPeer264
    Member

    How exactly are you running your custom fetch logic in Cloudflare? I'd like to know if there are different techniques for it. Have you already tried to get Sentry up and running with your setup?

  8. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Apr 27, 2026
  9. vmsp commented on Apr 27, 2026

    @vmsp

    How exactly are you running your custom fetch logic in Cloudflare? I'd like to know if there are different techniques for it.

    Thanks for the extremely quick reply @JPeer264. I'm using both Cloudflare Sandbox and Dynamic Workers to handle some requests that are not supposed to be passed to Tanstack Start. My endpoint roughly looks like this:

    import handler from "@tanstack/react-start/server-entry";
    
    export default {
      async fetch(request: Request, env: Cloudflare.Env, ctx: ExecutionContext) {
        if (requestToSandbox(request) {
          return proxyToSandbox(request);
        }
    
        if (requestToDynamicWorker(request)) {
          return dynamicWorkerHandler(request);
        }
    
        if (request.method === "GET" || request.method === "HEAD") {
          const asset = await env.ASSETS.fetch(request);
          if (asset.status !== 404) return asset;
        }
    
        return handler.fetch(request);
      },
    
      async queue(batch: MessageBatch<{ type: string }>) {
        // Handle jobs
      },
    
      async scheduled() {
        // Handle crons
      },
    }

    Ideally, I be able to capture errors from handler.fetch(request), queue and scheduled and ignore everything else but I'll take whatever's feasible.

    Have you already tried to get Sentry up and running with your setup?

    I didn't because I saw this "This setup does not currently work for Cloudflare deployments." on the setup docs: https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/#without---import-flag-eg-vercel-netlify. But I can give it a go.

  10. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Apr 27, 2026
  11. JPeer264 commented on Apr 27, 2026

    @JPeer264
    Member

    Ok that makes sense, thx for the setup. Could you try to follow the Cloudflare SDK setup? It looks like it could work in that case. The only issue is that Tanstack specific traces wouldn't be there.

  12. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions