Convex R2 component not working when imported
When import convex r2 component to convex.config.ts
import r2 from '@convex-dev/r2/convex.config';
import shardedCounter from '@convex-dev/sharded-counter/convex.config';
import { defineApp } from 'convex/server';
const app = defineApp();
app.use(shardedCounter);
app.use(r2);
export default app;
it causes the error like
✘ [ERROR] Could not resolve "tslib"
node_modules/@aws-crypto/sha256-js/build/module/jsSha256.js:1:39:
1 │ import { awaiter, generator } from "tslib";
╵ ~~~
You can mark the path "tslib" as external to exclude it from the bundle, which will
remove this error and leave the unresolved path in the bundle.
✘ [ERROR] Could not resolve "tslib"
3 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Can you try adding tslib to external packages in convex.json: https://docs.convex.dev/functions/bundling#specifying-external-packages
Bundling | Convex Developer Hub
How Convex bundles and optimizes your function code
Make sure convex dev is running and the change is successfully deployed (maybe need to restart the server for convex.json changes, not sure)
If that doesn't work try adding @aws-crypto/sha256-js to externals