Issue with esbuild + workers runtime, static method
The issue is that esbuild compiles some typescript into javascript, and then cloudflare is not able to handle the static built file.
The error is
✘ [ERROR] service core:user:silverkey: Uncaught TypeError: Object.defineProperty called on non-object
✘ [ERROR] service core:user:silverkey: Uncaught TypeError: Object.defineProperty called on non-object
If we look at the compiled code, we see it is calling
__name
__name
, which calls
Object.defineProperty
Object.defineProperty
. The place where it has problems is on the class itself:
class Keys { static { __name(this, "Keys"); }// ...
class Keys { static { __name(this, "Keys"); }// ...
The static method should get
this
this
as a reference to the class.
The issue is that this does work in node + browsers, but only has a problem in Cloudflare.
The library in question is open source, https://github.com/bicycle-codes/keys. The compiled code is not committed; you would need to npm install it in order to get it, or clone and build yourself.
Thanks for assistance. I can create an issue in github if that's preferable.