Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't deploy conversations plugin on Cloudflare Workers #104

Open
Nesquik opened this issue May 3, 2024 · 2 comments
Open

Can't deploy conversations plugin on Cloudflare Workers #104

Nesquik opened this issue May 3, 2024 · 2 comments

Comments

@Nesquik
Copy link

Nesquik commented May 3, 2024

Hi there, I'm getting the following error while trying to build a bot on Cloudflare after having installed the conversations plugin:

✘ [ERROR] Could not resolve "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/chmod.js:28:32:
      28 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/chown.js:28:32:
      28 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/copyFile.js:31:32:
      31 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/link.js:28:32:
      28 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/lstat.js:31:32:
      31 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/makeTempDir.js:5:27:
      5 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/mkdir.js:8:27:
      8 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/readDir.js:8:27:
      8 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/readFile.js:8:27:
      8 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/readLink.js:28:32:
      28 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/readTextFile.js:8:27:
      8 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/realPath.js:28:32:
      28 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/remove.js:5:27:
      5 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/rename.js:5:27:
      5 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/stat.js:8:27:
      8 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/symlink.js:28:32:
      28 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/truncate.js:31:32:
      31 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/watchFs.js:5:27:
      5 │ const promises_1 = require("fs/promises");
        ╵                            ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/writeFile.js:31:32:
      31 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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 "fs/promises"

    node_modules/@deno/shim-deno/dist/deno/stable/functions/writeTextFile.js:31:32:
      31 │ const fs = __importStar(require("fs/promises"));
         ╵                                 ~~~~~~~~~~~~~

  The package "fs/promises" 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] Build failed with 20 errors:

  node_modules/@deno/shim-deno/dist/deno/stable/functions/chmod.js:28:32: ERROR: Could not
  resolve "fs/promises"
  node_modules/@deno/shim-deno/dist/deno/stable/functions/chown.js:28:32: ERROR: Could not
  resolve "fs/promises"
  node_modules/@deno/shim-deno/dist/deno/stable/functions/copyFile.js:31:32: ERROR: Could not
  resolve "fs/promises"
  node_modules/@deno/shim-deno/dist/deno/stable/functions/link.js:28:32: ERROR: Could not
  resolve "fs/promises"
  node_modules/@deno/shim-deno/dist/deno/stable/functions/lstat.js:31:32: ERROR: Could not
  resolve "fs/promises"
  ...

My package.json dependencies:

  "dependencies": {
    "@grammyjs/conversations": "^1.2.0",
    "@grammyjs/menu": "^1.2.1",
    "@grammyjs/storage-cloudflare": "^2.4.2",
    "dotenv": "^16.4.5",
    "drizzle-orm": "^0.30.10",
    "grammy": "^1.22.4",
  },
  "devDependencies": {
    "@cloudflare/workers-types": "^4.20240423.0",
    "@types/node": "^20.12.8",
    "drizzle-kit": "^0.20.17",
    "typescript": "^5.4.5",
    "wrangler": "3.53.0"
  }

From the looks of it o-son has @deno/shim-deno as a dependency and it all breaks down from there.

My wrangler.toml already has the node_compat = true and compatibility_date = "2023-01-16" like noted here: https://grammy.dev/hosting/cloudflare-workers-nodejs

Any hints on how to approach this would be very appreciated, thanks.

@Spetsnaz116
Copy link

There'a a quick workaround, just create a local version of it. You can copy the relevant parts from o-son package and grammy conversations locally, hook them up, get rid of the deno stuff, you're good to go.

@KnorpelSenf
Copy link
Member

This is an effective duplicate of grammyjs/grammY#372

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants