#Tauri + Express Sidecar works on Mac, but on Windows the app can't connect (while Postman can).

13 messages · Page 1 of 1 (latest)

cursive frost
#

Hey,

I'm hoping to get some help with a really confusing Windows-specific issue for my Tauri desktop app

The Architecture:

  • Frontend: Next.js (statically exported with next build).
  • Backend: A standalone Express.js server that handles a streaming API endpoint (/api/proxy-check).
  • Packaging: I'm using esbuild to bundle the Express server into a single JS file, and then pkg to compile that into a standalone executable binary (server.exe for Windows).

The final server.exe is bundled as a sidecar using externalBin in my tauri.conf.json, and my app starts it using Command.sidecar in a React hook.

The Problem:

  • On macOS: Everything works flawlessly. The app launches, the sidecar starts, the frontend connects to http://localhost:3001, and the API works.
  • On Windows: This is where it gets weird.
    • The app installs and launches correctly.
    • My useApi hook successfully spawns the server.exe sidecar. I can see it running in the Task Manager.
    • I can take the API URL (http://localhost:3001/api/proxy-check) and hit it with Postman on the same Windows machine, and it works perfectly. I get the correct streaming response.
    • However, the fetch request from within the Tauri app itself fails. The DevTools console shows a TypeError: Load failed, which seems to be a generic network error.

This proves the server is running and functional, but something is specifically blocking the connection between the Tauri webview (WebView2 on Windows) and the localhost server.

#

Would somehow messing with the http plugin client be of any use?

#

please tag me when someone answers this 🙂

twin oasis
#

Check the headers, postman sends a lot of additional headers which actually helps in creating a connection.

@cursive frost

cursive frost
cursive frost
#

Nothing that worked for me, any other ideas ?

uncut zodiac
#

just by using the regular fetch
The issue is most likely caused by CORS. It should work with the http plugin.

uncut zodiac
#

That might explain the different behaviour between macOS and Windows. Microsoft dropped support for Windows 7 and 8 before that update so they won't have the API. Wry, Tauri's upstream webview interface, supports Windows 7, 8, 10, and 11.

cursive frost
#

It didn't really prevent me from starting the app or building, but yeah just saying, will try on windows in a few, thank you for the direction

cursive frost
#

It worked, thank you very much 🫡