M
Mastraโ€ข2w ago
Omicrxn

Pass custom fetch to mastra client

Hi I would like to request a parameter to the mastra client which would be a "fetch" mostly like in ai-sdk. My use case is that I'm using tauri and i need to pass tauri custom fetch in order to not get timeout error on macos. Tauri uses macos webview which is based on safari and safari stablishes a default timeout which can't be changed unless using Tauri fetch plugin.
ts
public chat = new Chat({
transport: new DefaultChatTransport({
api: AI_SERVER_URL,
fetch: fetch,
body:{
userId: page.data.user.id }
}),
....
})
ts
public chat = new Chat({
transport: new DefaultChatTransport({
api: AI_SERVER_URL,
fetch: fetch,
body:{
userId: page.data.user.id }
}),
....
})
I would like to do something like new MastraClient({baseURl:URL, fetch:fetch}) or similar also i'd like to report that the docs on the mastra client are outdated as tool.execute() does not take 'args' anymore but a 'data' https://mastra.ai/reference/client-js/tools
Reference: Tools API | Client SDK | Mastra Docs
Learn how to interact with and execute tools available in the Mastra platform using the client-js SDK.
4 Replies
Mastra Triager
Mastra Triagerโ€ข2w ago
๐Ÿ“ Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10673 ๐Ÿ” If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly. ๐Ÿ™ Thank you for helping us improve Mastra!
Abhi Aiyer
Abhi Aiyerโ€ข7d ago
hey @Omicrxn ill have a PR shortly
Omicrxn
OmicrxnOPโ€ข7d ago
Fast as hell as usual, appreciate it @Abhi Aiyer!
Abhi Aiyer
Abhi Aiyerโ€ข7d ago
GitHub
feat: add custom fetch support to MastraClient by abhiaiyer91 ยท Pu...
Adds support for passing a custom fetch function to MastraClient, similar to how ai-sdk handles it. This is useful for environments like Tauri that require custom fetch implementations to avoid tim...

Did you find this page helpful?