Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The assetserver.Options.Handler does not work in dev mode #3944

Open
eryx opened this issue Dec 12, 2024 · 2 comments
Open

The assetserver.Options.Handler does not work in dev mode #3944

eryx opened this issue Dec 12, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@eryx
Copy link

eryx commented Dec 12, 2024

Description

type custemHttpHandler struct {}

func (h *custemHttpHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request) {
  log.Printf("handler serve %s", req.URL.Path)
}

err := wails.Run(&options.App{
  AssetServer: &assetserver.Options{
    Assets:  assets,
    Handler: &custemHttpHandler{},
  },
})

To Reproduce

wails dev

log output:

DEB | [AssetHandler] File 'file/id/e6d95e4' not found, serving '/file/id/e6d95e4' by AssetHandler
DEB | [ExternalAssetHandler] Loading 'http://localhost:5173/file/id/e6d95e4'

Expected behaviour

use wails build and exec "./build/bin/myproject.app/Contents/MacOS/myproject" working fine.

log output:

DEB | [AssetHandler] File 'file/id/e6d95e4' not found, serving '/file/id/e6d95e4' by AssetHandler
handler serve file/id/e6d95e4

Screenshots

No response

Attempted Fixes

No response

System Details

# Wails
Version | v2.9.2

# System

| OS           | MacOS                                                                                                                 
| Version      | 14.6.1                                                                                                                 
| Go Version   | go1.23.2                                                                                                               
| Platform     | darwin                                                                                                                 
| Architecture | arm64

Additional context

No response

@eryx eryx added the Bug Something isn't working label Dec 12, 2024
@leaanthony
Copy link
Member

Trying to load Go assets from the Vite port in this way isn't going to work. Try opening http://localhost:34115

@eryx
Copy link
Author

eryx commented Dec 25, 2024

  1. Thank you for your response, but using the localhost: 34115 method still doesn't work.
  2. In the new situation, adding a file extension, such as changing /file/id/e6d95e4 to /file/id/e6d95e4.json, made it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants