amianthusA
Convex Community10mo ago
8 replies
amianthus

Can't deploy to Vercel with Next.js

When I push to vercel and it runs the "npx convex deploy --cmd 'bun run build'", it keeps giving me nextjs's node api errors and telling me to add use node directives but thats for the frontend no?
    node_modules/next/dist/compiled/gzip-size/index.js:1:2840:
      1 │ ...use strict";e.exports=require("fs")},781:e=>{"use strict";e.expo...
        ╵                                  ~~~~
  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
✘ [ERROR] Could not resolve "stream"
    node_modules/next/dist/compiled/gzip-size/index.js:1:2886:
      1 │ ...e strict";e.exports=require("stream")},796:e=>{"use strict";e.ex...
        ╵                                ~~~~~~~~
  The package "stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
✘ [ERROR] Could not resolve "zlib"
    node_modules/next/dist/compiled/gzip-size/index.js:1:2936:
      1 │ ...se strict";e.exports=require("zlib")}};var r={};function __nccwp...
        ╵                                 ~~~~~~
  The package "zlib" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
✖ It looks like you are using Node APIs from a file without the "use node" directive.
See https://docs.convex.dev/functions/runtimes#nodejs-runtime

I added "use node" to my convex routes anyways but still nothing works
Was this page helpful?