reflect-metadata on Deno Deploy not working?
Is there a reason why no reflect-metadata-libs work on deno deploy?
I have tried the following:
- https://www.npmjs.com/package/@abraham/reflection
- https://deno.land/x/reflect_metadata@v0.1.12-2
- https://deno.land/x/deno_reflect@v0.2.1
- https://deno.land/x/reflection@0.0.2
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
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 orseeking 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. 🦕
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.
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: