-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the Bug
The Cloudflare deployer applies the postgres-store-instance-checker
Babel plugin unconditionally, even when PostgresStore is not being used in the application. This causes build failures with the error:
ERROR: postgres-store-instance-checker plugin did not return code, there is likely a bug in the plugin.
Root Cause:
The postgres-store-instance-checker
plugin is always included in the bundler options regardless of whether @mastra/pg
is actually used as a dependency:
// Current problematic implementation
inputOptions.plugins = [
virtual({ ... }),
...inputOptions.plugins,
postgresStoreInstanceChecker(), // ← Always applied
mastraInstanceWrapper(mastraEntryFile),
];
Impact:
- Applications using other storage solutions (Redis, Memory, D1, etc.) fail to build
- Applications with no storage at all fail to build
- Unnecessary Babel transformations are performed even when not needed
Steps To Reproduce
- Create a Mastra app using Redis or Memory storage (no @mastra/pg dependency)
- Configure Cloudflare deployer
- Run build command
- Observe the plugin error
Expected Behavior
The postgres-store-instance-checker
plugin should only be applied when:
@mastra/pg
package is actually installed as a dependency- PostgresStore is being used in the application
Proposed Solution:
// Check if PostgresStore is being used before applying the plugin
const hasPostgresStore = (await this.deps.checkDependencies(['@mastra/pg'])) === `ok`;
if (hasPostgresStore) {
plugins.push(postgresStoreInstanceChecker());
}
This would ensure:
- ✅ PostgresStore users get proper instance validation
- ✅ Non-PostgresStore users can build without errors
- ✅ Better performance by skipping unnecessary transformations
Environment Information
- @mastra/deployer-cloudflare 0.13.8-alpha.0
- mastra 0.16.3
- Nodejs v22.15.0
- OS MacOS 15.6.1
Verification
- I have searched the existing issues to make sure this is not a duplicate
- I have included sufficient information for the team to reproduce and understand the issue
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working