kwhitley / itty-router

A little router.
MIT License
1.79k stars 78 forks source link

Error [ERR_INTERNAL_ASSERTION]: Error [ERR_INTERNAL_ASSERTION]: TypeError: o.toUpperCase is not a function #174

Closed Faboslav closed 1 year ago

Faboslav commented 1 year ago

Hello, i am trying to use itty-router v3.0.11 on node 18.16.0 on docker and i got following error from it:

Error [ERR_INTERNAL_ASSERTION]: Error [ERR_INTERNAL_ASSERTION]: TypeError: o.toUpperCase is not a function
    at Object.<anonymous> (/var/www/node/node_modules/itty-router/dist/itty-router.js:1:118)
    at formatValue (node:internal/util/inspect:806:19)
    at formatProperty (node:internal/util/inspect:1920:11)
    at formatRaw (node:internal/util/inspect:1055:9)
    at formatValue (node:internal/util/inspect:841:10)
    at formatProperty (node:internal/util/inspect:1920:11)
    at formatRaw (node:internal/util/inspect:1055:9)
    at formatValue (node:internal/util/inspect:841:10)
    at inspect (node:internal/util/inspect:365:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2273:40)
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
    at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
    at new NodeError (node:internal/errors:399:5)
    at Function.fail (node:internal/assert:20:9)
    at handleMaxCallStackSize (node:internal/util/inspect:1550:10)
    at formatRaw (node:internal/util/inspect:1063:12)
    at formatValue (node:internal/util/inspect:841:10)
    at formatProperty (node:internal/util/inspect:1920:11)
    at formatRaw (node:internal/util/inspect:1055:9)
    at formatValue (node:internal/util/inspect:841:10)
    at inspect (node:internal/util/inspect:365:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2273:40)
    at formatWithOptions (node:internal/util/inspect:2135:10)
    at console.value (node:internal/console/constructor:340:14)
    at console.log (node:internal/console/constructor:377:61)
    at Composer (/var/www/node/src/services/Composer.ts:21:13)
    at <anonymous> (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:296:20)
    at InternalDependencyContainer.construct (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:297:9)
    at InternalDependencyContainer.resolveRegistration (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:166:51)
    at InternalDependencyContainer.resolve (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:109:33)
    at <anonymous> (/var/www/node/src/index.ts:18:32)
    at Object.<anonymous> (/var/www/node/src/index.ts:69:2)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Object.F (/var/www/node/node_modules/@esbuild-kit/cjs-loader/dist/index.js:1:941)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
    at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
    at new NodeError (node:internal/errors:399:5)
    at Function.fail (node:internal/assert:20:9)
    at handleMaxCallStackSize (node:internal/util/inspect:1550:10)
    at formatRaw (node:internal/util/inspect:1063:12)
    at formatValue (node:internal/util/inspect:841:10)
    at inspect (node:internal/util/inspect:365:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2273:40)
    at formatWithOptions (node:internal/util/inspect:2135:10)
    at console.value (node:internal/console/constructor:340:14)
    at console.log (node:internal/console/constructor:377:61)
    at Composer (/var/www/node/src/services/Composer.ts:21:13)
    at <anonymous> (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:296:20)
    at InternalDependencyContainer.construct (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:297:9)
    at InternalDependencyContainer.resolveRegistration (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:166:51)
    at InternalDependencyContainer.resolve (/var/www/node/node_modules/tsyringe/dist/cjs/dependency-container.js:109:33)
    at <anonymous> (/var/www/node/src/index.ts:18:32)
    at Object.<anonymous> (/var/www/node/src/index.ts:69:2)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Object.F (/var/www/node/node_modules/@esbuild-kit/cjs-loader/dist/index.js:1:941)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
  code: 'ERR_INTERNAL_ASSERTION'
}
Node.js v18.16.0

what can i do about it? All i need to do is import the itty-router like following: import { Router as BaseRouter } from "itty-router"; and there is an error.

Faboslav commented 1 year ago

It says that o is string | symbol, in that case would o.toString().toUpperCase() help?

kwhitley commented 1 year ago

Any chance you can try 4.0.9 or 4.0.11 and let me know how it works?

Faboslav commented 1 year ago

With newest version of 4.0.11 this seems to be fixed now, thanks!

kwhitley commented 1 year ago

Terrific! Thanks for checking!