Worker deploys started failing with "Uncaught Error: No such module "punycode""

Hi all! We're using Workers for Platforms to deploy Hono-based workers and as of a few days ago, the deployment requests started failing with
{
result: null,
success: false,
errors: [
{
code: 10021,
message: 'Uncaught Error: No such module "punycode".\n' +
' imported from "worker.js"\n'
}
],
messages: []
}
{
result: null,
success: false,
errors: [
{
code: 10021,
message: 'Uncaught Error: No such module "punycode".\n' +
' imported from "worker.js"\n'
}
],
messages: []
}
Have there been any changes made to the platform? We didn't change our build process and this is happening with previously successfully deploying code. Is there a recommended way around this? We're deploying with the following flags:
compatibility_date: "2023-08-23",
compatibility_flags: ["nodejs_compat"],
compatibility_date: "2023-08-23",
compatibility_flags: ["nodejs_compat"],
1 Reply
Viktor
Viktor7mo ago
The version of the punycode module bundled in Node.js is being deprecated. In a future major version of Node.js this module will be removed. Users currently depending on the punycode module should switch to using the userland-provided Punycode.js module instead.
Looks like it has been removed now. You could npm i -s punycode and use
// CommonJS
const punycode = require('punycode/');
// ES Module
import punycode from "punycode/";
// CommonJS
const punycode = require('punycode/');
// ES Module
import punycode from "punycode/";
which also hides the deprecation warning in older node js versions

Did you find this page helpful?