N
Nuxt2w ago
thasmo

Vue Router warning for valid server route

I've a server route configured at /server/routes/images/[...path].get.ts but when called in the frontend, I get these warnings in the terminal:
WARN [Vue Router warn]: No match found for location with path "/images/properties/photos/01JR5W6KCRXZ21CYE4HGTKEEV0"
To be clear, the called URL is a working URL and returns the image correctly in the frontend. Is this to be expected? Is there a way to disable the warning for this specific route?
2 Replies
kapa.ai
kapa.ai2w ago
Hi @thasmo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- This warning is expected behavior in Nuxt when you have server routes that aren't registered as Vue Router routes. The warning is simply Vue Router informing you that it doesn't have a matching client-side route for the path you're requesting. Based on the knowledge sources, this is a common situation that occurs in several scenarios: 1. When you have server routes (like your image route) that don't correspond to page routes 2. When other tabs or service workers are requesting routes 3. When static resources are being requested As mentioned by a Nuxt team member in one of the GitHub issues:
"This is because you have other tabs or service workers requesting those routes. The warning is simply telling you that vue router is returning a 404" GitHub Issue #29042
The important thing is that your server route is working correctly and returning the image as expected, so this warning doesn't indicate a functional problem. Solutions: There isn't a direct way to disable the warning for specific routes mentioned in the provided knowledge sources. However, you could try one of these approaches: 1. Use the external prop with <NuxtLink> when linking to these resources to bypass Vue Router's internal routing mechanism:
<NuxtLink to="/images/properties/photos/01JR5W6KCRXZ21CYE4HGTKEEV0" external>
View Image
</NuxtLink>
<NuxtLink to="/images/properties/photos/01JR5W6KCRXZ21CYE4HGTKEEV0" external>
View Image
</NuxtLink>
This tells Nuxt to treat the link as external, as described in the NuxtLink documentation. 2. Consider moving your images to the /public directory if they're static assets, which would make them directly accessible without going through your server route. The warning doesn't affect functionality and is more of a developer experience issue, so you can safely continue using your current approach if it's working for your needs. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@110478559113416704> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?