Netlify deployer error

Hello, I am trying MastraAI out for an internal mcp server project I am building. My team already has a netlify account so I am trying to deploy a standalone mastra app to netlify using the netlify deployer as outlined in the docs. The deploy is successful on Netlify but I then I get the following error on the function call to the api endpoint. The error can also be viewed here -> https://checkr-mastra-storyblok.netlify.app/
SyntaxError: Identifier '__filename' has already been declared
at compileSourceTextModule (node:internal/modules/esm/utils:346:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18)
at #translate (node:internal/modules/esm/loader:536:12)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:583:27)
at async ModuleJob._link (node:internal/modules/esm/module_job:162:19)
SyntaxError: Identifier '__filename' has already been declared
at compileSourceTextModule (node:internal/modules/esm/utils:346:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18)
at #translate (node:internal/modules/esm/loader:536:12)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:583:27)
at async ModuleJob._link (node:internal/modules/esm/module_job:162:19)
This is my mastra config
export const mastra = new Mastra({
workflows: { weatherWorkflow },
agents: { weatherAgent },
logger: new PinoLogger({
name: 'Mastra',
level: 'info',
}),
observability: {
default: { enabled: true },
},
mcpServers: {
server: storyblokMcpServer,
},
deployer: new NetlifyDeployer(),
});
export const mastra = new Mastra({
workflows: { weatherWorkflow },
agents: { weatherAgent },
logger: new PinoLogger({
name: 'Mastra',
level: 'info',
}),
observability: {
default: { enabled: true },
},
mcpServers: {
server: storyblokMcpServer,
},
deployer: new NetlifyDeployer(),
});
These are my project deps:
"dependencies": {
"@mastra/core": "^0.22.2",
"@mastra/evals": "^0.14.1",
"@mastra/deployer-netlify": "^0.13.12",
"@mastra/libsql": "^0.16.0",
"@mastra/loggers": "^0.10.17",
"@mastra/mcp": "^0.14.0",
"@mastra/memory": "^0.15.8",
"storyblok-js-client": "^7.1.5",
"zod": "^4.1.12"
},
"devDependencies": {
"@types/node": "^24.9.1",
"mastra": "^0.17.3",
"typescript": "^5.9.3"
}
"dependencies": {
"@mastra/core": "^0.22.2",
"@mastra/evals": "^0.14.1",
"@mastra/deployer-netlify": "^0.13.12",
"@mastra/libsql": "^0.16.0",
"@mastra/loggers": "^0.10.17",
"@mastra/mcp": "^0.14.0",
"@mastra/memory": "^0.15.8",
"storyblok-js-client": "^7.1.5",
"zod": "^4.1.12"
},
"devDependencies": {
"@types/node": "^24.9.1",
"mastra": "^0.17.3",
"typescript": "^5.9.3"
}
1 Reply
victorCheckr
victorCheckrOP8h ago
I also get a build error on MastraCloud
[ERROR]
[10/22/2025, 05:02:12 PM] - Build process failed for build 2f04d0a5-19f3-4d1b-83fa-27c3b8107992 and project bcda9b51-89b9-41c6-81cc-c717a1c7d722: {"message":"Failed to analyze Mastra application: Could not load /data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs (imported by node_modules/@mastra/core/dist/chunk-AGD5B3FB.js): ENOENT: no such file or directory, open '/data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs'","details":{"message":"Failed to analyze Mastra application: Could not load /data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs (imported by node_modules/@mastra/core/dist/chunk-AGD5B3FB.js): ENOENT: no such file or directory, open '/data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs'","domain":"DEPLOYER","category":"SYSTEM","details":{}},"code":"DEPLOYER_BUNDLER_ANALYZE_FAILED"}
[ERROR]
[10/22/2025, 05:02:12 PM] - Failed to analyze Mastra application: Could not load /data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs (imported by node_modules/@mastra/core/dist/chunk-AGD5B3FB.js): ENOENT: no such file or directory, open '/data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs'
[ERROR]
[10/22/2025, 05:02:12 PM] - Build process failed for build 2f04d0a5-19f3-4d1b-83fa-27c3b8107992 and project bcda9b51-89b9-41c6-81cc-c717a1c7d722: {"message":"Failed to analyze Mastra application: Could not load /data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs (imported by node_modules/@mastra/core/dist/chunk-AGD5B3FB.js): ENOENT: no such file or directory, open '/data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs'","details":{"message":"Failed to analyze Mastra application: Could not load /data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs (imported by node_modules/@mastra/core/dist/chunk-AGD5B3FB.js): ENOENT: no such file or directory, open '/data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs'","domain":"DEPLOYER","category":"SYSTEM","details":{}},"code":"DEPLOYER_BUNDLER_ANALYZE_FAILED"}
[ERROR]
[10/22/2025, 05:02:12 PM] - Failed to analyze Mastra application: Could not load /data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs (imported by node_modules/@mastra/core/dist/chunk-AGD5B3FB.js): ENOENT: no such file or directory, open '/data/project/node_modules/@mastra/core/node_modules/ai/dist/index.mjs'
running netlify dev gives me the same error, would be great if I can get pointed in the right direction! I've tried adding the only other packaged I've installed to the bundler: { extrenals: [] } in the main mastra config but get the same error. Would love to use Mastra but not being able to build a live app is kind of a bummer.

Did you find this page helpful?