Mastra / Nuxt / Vercel AI SDK
hey all - i was having some errors trying to set up mastra/vercel ai sdk with nuxt.
i was putting things together from view links of docs:
https://ai-sdk.dev/docs/getting-started/nuxt
https://mastra.ai/en/docs/frameworks/agentic-uis/ai-sdk
I have a /chat endpoint in my server
payload seems to be coming in:
{"id":"HZXcWKWJA994MPVU","messages":[{"parts":[{"type":"text","text":"hello"}],"id":"gWFBOcONlGwMwFAk","role":"user"},{"parts":[{"type":"text","text":"tet"}],"id":"e501upXkL5u4uTRt","role":"user"}],"trigger":"submit-message"}
200 response with response coming back: 3:"An error occurred."
any thoughts/ideas on this?
/chat endpoint is basically:
any help would be greatly appreciated πVue.js (Nuxt)
Welcome to the AI SDK quickstart guide for Vue.js (Nuxt)!
Using with Vercel AI SDK
Learn how Mastra leverages the Vercel AI SDK library and how you can leverage it further with Mastra
3 Replies
Hi @Robby. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry, but the knowledge sources provided do not contain specific information about integrating Mastra with Nuxt or the Vercel AI SDK, nor do they cover troubleshooting the exact error message you are seeing with the Mastra agent and the /chat endpoint. The sources do include examples of using the Vercel AI SDK's useChat composable with Nuxt and how to structure server endpoints for OpenAI, but there is no mention of Mastra or its agent API, nor details about the error handling or expected payloads for Mastra agents.
If you are using the Vercel AI SDK with Nuxt, the typical server endpoint expects a payload with messages and possibly other fields (like agent), and then forwards these to an OpenAI-compatible API. The error handling in those examples returns a 500 status with an error message if something goes wrong, but there is no information about the Mastra agent's stream or toDataStreamResponse methods, or what could cause the "An error occurred." message in your context.
If you need help with Mastra specifically, I recommend consulting the official Mastra documentation or their support channels, as the knowledge sources here do not provide enough detail to diagnose or resolve your issue. If you have questions about using the Vercel AI SDK with Nuxt, or about building chat endpoints with OpenAI, I can help with that based on the sources provided.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@567348797286514688> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
UPDATE: got things working! ai sdk 5 is not working yet.. it blew everything up.. i also was on the new ai-sdk/vue 2.... needed to roll that back to latest 1.. after that ----- off to the races !
hope this helps someone! π