Skip to content

Bot constructor broken on Deno <2.1.0 #21

@natepmay

Description

@natepmay

This is not something to fix in this codebase, but I wanted to leave it here in case anyone else had hopes of deploying a bot on Deno Deploy. Tl;dr: It looks like that won't be possible until January-ish when they upgrade Deploy to Deno v2.1.0+ (right now it's at 1.46.3).

Running new Bot() on Deno <2.1.0 results in the following error:

TypeError [ERR_INVALID_ARG_TYPE]: The "callback" argument must be of type function. Received type number (5000)
    at __node_internal_ (ext:deno_node/internal/validators.mjs:283:13)
    at setInterval (node:timers:34:3)
    at ext:deno_node/internal/util.mjs:97:15
    at new Promise (<anonymous>)
    at setInterval (ext:deno_node/internal/util.mjs:82:12)
    at BotEventEmitter.startPolling (file:///node_modules/.deno/@skyware+bot@0.3.8/node_modules/@skyware/bot/dist/bot/BotEventEmitter.js:259:26)
    at new BotEventEmitter (file:///node_modules/.deno/@skyware+bot@0.3.8/node_modules/@skyware/bot/dist/bot/BotEventEmitter.js:94:18)
    at new Bot (file:///node_modules/.deno/@skyware+bot@0.3.8/node_modules/@skyware/bot/dist/bot/Bot.js:68:33)

That's because Deno is trying to re-create a module from Node and gets confused about which implementation of setInterval() to use (here's the issue). It was fixed in 2.1.0 which went out a few days ago, but hasn't made it to Deno Deploy yet. The team told me they were hoping to upgrade in December. If you want to know which Deno version you're running in Deploy, you can use navigator.userAgent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions