Skip to content

Start + https preview server fails on res.setHeaders is not a function #6294

@susickypavel

Description

@susickypavel

Which project does this relate to?

Start

Describe the bug

When running the preview server in SPA mode with HTTPS enabled, the server fails to serve the application shell. Instead, it crashes with an error below:

TypeError: res.setHeaders is not a function
    at file:///X:/experiments/tanstack-preview-server-https-bug/node_modules/@tanstack/start-plugin-core/dist/esm/preview-server-plugin/plugin.js:31:19

Development server with HTTPS certificates works fine.

Your Example Website or App

https://github.com/susickypavel/tanstack-preview-server-https-bug

Steps to Reproduce the Bug or Issue

  1. Clone the repository
git clone git@github.com:susickypavel/tanstack-preview-server-https-bug.git
cd ./tanstack-preview-server-https-bug
  1. Create certificates for example.localhost
mkdir .certs
cd .certs
mkcert example.localhost "*.example.localhost"
  1. Add example.localhost to hosts file
# For Mac or Linux
nano /etc/hosts

127.0.0.1 example.localhost
  1. Install dependencies and run the preview server
bun install
bun run build:preview

Expected behavior

I'd expect the preview server to work the same way it works for bun dev, but it should use the production files instead.

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.132.0
  • OS: Windows
  • Browser: All
  • Bundler: vite

Additional context

No response

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