iway1 / trpc-panel

MIT License
627 stars 43 forks source link

[Bug] No match found for location with path "/api/bundle.js.map" #99

Open zoey-kaiser opened 6 months ago

zoey-kaiser commented 6 months ago

Hello! Thank you for your awesome work! We are currently experiencing the following issue with our setup. Whenever we try and load the page we get the following error message in the server console:

Error

[Vue Router warn]: No match found for location with path "/api/bundle.js.map"

On the client we get the following other error:

Uncaught TypeError: n is undefined
    TT http://localhost:3000/api/docs:1178
    ys http://localhost:3000/api/docs:1081
    yu http://localhost:3000/api/docs:1081
    fc http://localhost:3000/api/docs:1081
    cc http://localhost:3000/api/docs:1081
    uc http://localhost:3000/api/docs:1081
    Xu http://localhost:3000/api/docs:1081
    Yu http://localhost:3000/api/docs:1081
    x http://localhost:3000/api/docs:1071
    O http://localhost:3000/api/docs:1071
    EventHandlerNonNull* http://localhost:3000/api/docs:1071
    <anonymous> http://localhost:3000/api/docs:1071
    <anonymous> http://localhost:3000/api/docs:1061
    <anonymous> http://localhost:3000/api/docs:1061
docs:1178:25369

Environment

We have the following systems installed:

------------------------------
- Operating System: Darwin
- Node Version:     v20.6.1
- Nuxt Version:     3.8.0
- Nitro Version:    2.7.2
- Package Manager:  pnpm@8.7.5
- `trpc-panel` version: 1.3.4 (but also tested with `1.2.8`)
------------------------------

As you can see above we are using Nuxt3! We have the trpc-panel integrated in the following way:

import { renderTrpcPanel } from 'trpc-panel'
import { router } from '../trpc/routers'

export default eventHandler((event) => {
  setResponseHeader(event, 'content-type', 'text/html; charset=utf-8')
  return renderTrpcPanel(router, {
    url: '/api/trpc',
    transformer: 'superjson',
  })
})

The router we import is the router taken from:

export const t = initTRPC.context<Context>().create({
  transformer: superjson,
})

export const createRouter = t.router
thepeterkovacs commented 4 months ago

Same problem. It seems like in the build the route.js file contains the absolute path to the bundle.js file. A quick workaround fix is to override the path generated in the (in my case in Next.js) .next\server\app\api\trpc\panel\route.js to the correct one. Unfortunately it has to be done for every build, so it is a major issue.