Apologies for the delay, the Bun team told us that this can happen when using top-level await along with require and cyclic dependencies. Any minimal reproduction would be appreciated to help getting this fixed.
I can confirm for me, the issue was using path aliases in tsconfig.json. My project is Bun + Elysia, and by removing baseUrl and paths from tsconfig everything works fine, and I get the joys of import foo from “../../../lib/foo/bar.js” now
but at least it works
Found a workaround for the Requested module is not instantiated yet error when using ConvexHttpClient with the Bun runtime on Vercel.
The issue seems tied to how the Bun runtime preset handles module resolution in Serverless Functions. I fixed this by switching the execution environment to the Node.js runtime while keeping the Bun toolchain for the rest of the flow.
The Fix:
-
Use
@elysiajs/node(or your framework’s Node adapter). -
Set
vercel.jsonto use@vercel/nodefor the build. -
Use strict ESM imports (include
.jsextensions) in your TS files so the Node runtime can resolve them.
This setup allows you to keep using Bun for local dev and fast installs, but utilizes the stable Node.js runtime in production to avoid the Convex instantiation bug.
So, is it strictly forbidden to use aliases in Bun projects? In my case, I’m using Elysia with absolute paths (“@/…”). This is necessary for good code readability. I ran into this error about four hours ago, but there’s very little documentation on this specific issue.
Bug Update: “Requested module is not instantiated yet” with Convex
I have identified that this error specifically occurs when using ConvexHttpClient from the convex package (v1.32.0).
The Root Cause:
The issue stems from a circular module graph within the convex/browser ESM entry points. Specifically:
-
convex/dist/esm/browser/simple_client.jsimports from./index.js. -
index.jsre-exportssimple_client.js.
While this resolves correctly in Node.js and local Bun environments, the Vercel Bun Runtime (Beta) fails during the module linking phase, leading to the TypeError: Requested module is not instantiated yet.
Official Issue Tracked Here:
I have opened a formal issue with the Convex team to see if the module graph can be flattened:
https://github.com/get-convex/convex-backend/issues/394
Current Workaround:
To unblock your deployment, switch from the Bun runtime to the Node.js runtime on Vercel:
-
Use
@elysiajs/node(or your framework’s Node adapter). -
Update
vercel.jsonto use the@vercel/nodebuilder. -
Important: Ensure all internal relative imports in your TypeScript files use explicit
.jsextensions (e.g.,import { routes } from './routes.js') so the Node ESM loader can resolve them without the “module not found” error.
I initially suspected my path aliases (@/...) were causing this, but after some deep diving, I found that wasn’t the case. Path aliases are generally fine in Bun/Elysia projects as long as they are mapped correctly in your tsconfig.json.
In my case, the Requested module is not instantiated yet error was actually triggered by the convex package (@1.32.0). There is a circular dependency in their ESM entry point (convex/browser) that the Vercel Bun runtime (Beta) struggles to link, even though it works fine in local Bun and Node.js environments.
If you are seeing this error and using Convex (or other libraries with complex barrel exports), the aliases might be a red herring. The real issue is likely the runtime’s ESM linker.