Thomas
Thomas2mo ago

reflect-metadata on Deno Deploy not working?

npm
@abraham/reflection
Lightweight ES Module implementation of reflect-metadata. Latest version: 0.12.0, last published: a year ago. Start using @abraham/reflection in your project by running npm i @abraham/reflection. There are 59 other projects in the npm registry using @abraham/reflection.
4 Replies
Deno AI Helper
Deno AI Helper2mo ago
It seems you're encountering issues with various reflection libraries when trying to use them with Deno Deploy. According to the documentation, there was a specific case where someone faced a deployment failure using tsyringe along with reflect-metadata. The error mentioned was "TypeInfo not known for 'Foo'", which suggests that there might be an issue with the reflection metadata being available or correctly used at runtime in the Deno Deploy environment. Reflection and metadata are often used in conjunction with dependency injection libraries to automatically resolve dependencies, but this relies on certain language features or polyfills that may not be fully supported or behave differently in the Deno Deploy environment compared to the standard Deno runtime. Here are a few steps you can take to troubleshoot this issue: 1. Check Compatibility: Ensure that the libraries you are trying to use are compatible with Deno Deploy. Some libraries might work well in the standard Deno runtime but may have issues in the serverless environment provided by Deno Deploy. 2. Review Library Documentation: Look at the documentation for the libraries you're trying to use to see if there are any known issues or additional steps required to make them work with Deno Deploy. 3. Minimal Reproducible Example: Try to create a minimal example that reproduces the issue. This can help isolate the problem and also provide a clear case to report to the library maintainers if there's a bug. 4. Check for Updates: Make sure you are using the latest versions of the libraries, as there may have been updates or fixes that address compatibility with Deno Deploy. 5. Seek Support: If you continue to have issues, consider reaching out to the maintainers of the libraries or
Deno AI Helper
Deno AI Helper2mo ago
seeking help from the Deno community. You can report issues on the respective libraries' issue trackers. 6. Alternative Approaches: If reflection-based libraries continue to be problematic, you might need to consider alternative approaches to dependency injection that do not rely on reflection metadata. Remember that Deno Deploy has its own set of constraints and execution environment, which may not always align with the standard Deno runtime or Node.js environments. 🦕
Thomas
Thomas2mo ago
That is not very helpful. Especially not point 6, because my goal is to be able to use a dependency injection like in Angular, Nestjs, tsyringe or Danet on Deno Deploy. The problem seems to be the compiler option emitDecoratorMetadata which is probably not supported on Deno Deploy (see https://github.com/denoland/deploy_feedback/issues/633). Danet probably had the same problem and solved it by bundling the application. But deno bundle is deprecated so I would have to use a third party bundler, which is not great either.
GitHub
Issues · denoland/deploy_feedback
For reporting issues with Deno Deploy. Contribute to denoland/deploy_feedback development by creating an account on GitHub.
Thomas
Thomas2mo ago
Looks like bundeling is not an option either, because I use @oak/oak and oak uses the node specifier. And deno bundle does not support node specifier. And @deno/emit does not seem to be an alternative to bundling either, because here I get the following error message:
error: Uncaught (in promise) Error: Unable to output during bundling: load_transformed failed: failed to analyze module: failed to resolve /v135/.@latest/denonext/deno.json.js from https://esm.sh/v135/@jsr/std__http@0.221.0/denonext/file-server.js: Cannot resolve "/v135/.@latest/denonext/deno.json.js" from "https://esm.sh/v135/@jsr/std__http@0.221.0/denonext/file-server.js".
const ret = new Error(getStringFromWasm0(arg0, arg1));
^
at __wbg_new_28c511d9baebfa89 (https://jsr.io/@deno/emit/0.40.2/emit.generated.js:556:19)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:3526399)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:485448)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:2094778)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:3244744)
at __wbg_adapter_46 (https://jsr.io/@deno/emit/0.40.2/emit.generated.js:246:8)
at real (https://jsr.io/@deno/emit/0.40.2/emit.generated.js:231:14)
at ext:core/01_core.js:302:9
at eventLoopTick (ext:core/01_core.js:168:7)
Error: Process completed with exit code 1.
error: Uncaught (in promise) Error: Unable to output during bundling: load_transformed failed: failed to analyze module: failed to resolve /v135/.@latest/denonext/deno.json.js from https://esm.sh/v135/@jsr/std__http@0.221.0/denonext/file-server.js: Cannot resolve "/v135/.@latest/denonext/deno.json.js" from "https://esm.sh/v135/@jsr/std__http@0.221.0/denonext/file-server.js".
const ret = new Error(getStringFromWasm0(arg0, arg1));
^
at __wbg_new_28c511d9baebfa89 (https://jsr.io/@deno/emit/0.40.2/emit.generated.js:556:19)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:3526399)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:485448)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:2094778)
at <anonymous> (file:///home/runner/.local/share/deno-wasmbuild/96bf0f6a753e71948f71b7a491baca4d34264a2622a74d137b5ff37e4d86f571.wasm:1:3244744)
at __wbg_adapter_46 (https://jsr.io/@deno/emit/0.40.2/emit.generated.js:246:8)
at real (https://jsr.io/@deno/emit/0.40.2/emit.generated.js:231:14)
at ext:core/01_core.js:302:9
at eventLoopTick (ext:core/01_core.js:168:7)
Error: Process completed with exit code 1.