Why Deno runtime is differently when running locally or through Deno Cloud?
FYI: I did already post into the deploy feedback as well.
Posting here as well to gain more visibility, but here's the link to the repo where you can reproduce in less than 5 minutes. https://github.com/uptownhr/tiny-url/commit/a9201732bbc95525588a17e93e0afdc720646dbc
Locally,
1. clone
2. deno task dev
3. visit http://localhost:3000/
You'll see an empty array as your response and not a 500
Through Deno Cloud
1. deployctl deploy
2. visit the auto-generated deno url
Expected: same result as when you ran locally and visited the service
Actual: a 500
Here's the error
GitHub
[Bug]: Does not function on Deno Deploy but functions when running ...
Problem description Here is the repo that is resulting in a different behavior when I run locally vs when ran in deno cloud. My Github Project: Tiny Url Steps to reproduce Local STR clone deno task...
3 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the error message you've provided, it seems like there might be an issue with the
RedirectController.create
method in your controller.ts
file. The error TypeError: Cannot read properties of undefined (reading 'create')
suggests that the object you are trying to call the create
method on is undefined
.
This is not based on the Deno documentation, but you might want to check the controller.ts
file around line 30 to ensure that the object you expect to have a create
method is properly initialized and not undefined
. Make sure that any dependencies or services that the RedirectController
relies on are correctly provided and available in the context where you're trying to use them.
Since this advice is not based on the Deno documentation, please double-check the accuracy of the advice given and consider other potential causes for the discrepancy between the local and Deno Cloud environments. It's also a good idea to follow up on the issue you posted in the deploy feedback repository for more targeted assistance.Helpful Links:
Deno: the easiest, most secure JavaScript runtime | Deno Docs
Deno Deploy Beta 2
Deployments | Deno Docs
Deno: the easiest, most secure JavaScript runtime | Deno Docs
Deno 1.25 Release Notes
Private Modules and Repositories | Deno Docs
March 2 incident update
Deno deploy: "Error The deployment failed: ISOLATE_INTERNAL_FAILURE" - Deno
MongoDB connection error on Deno Deploy - Deno
@Deno AI Helper This is not helping to answer the quesiton, but so everyone else is not confused. The issue here is that, the error is seen in the Deno Cloud runtime but not in my local deno runtime.
Understood, and I apologize for any confusion. The discrepancy between the local Deno runtime and the Deno Cloud runtime can be due to a variety of factors, including differences in environment configurations, available resources, or subtle differences in how the runtimes handle certain operations.
Since the issue is specific to the Deno Cloud runtime and not reproducible locally, it's important to ensure that all environment variables and configurations are set correctly in the Deno Cloud environment. Additionally, since the error indicates that something is
undefined
, it could be related to how modules or dependencies are being resolved or accessed in the cloud environment.
Given that the advice is not based on the Deno documentation, and the issue is specific to the Deno Cloud runtime, the best course of action is to wait for a response from the Deno team on the deploy feedback issue you've posted. They will have the most context on how the Deno Cloud runtime operates and will be able to provide more targeted assistance for this environment-specific issue.Helpful Links:
Deno 1.36: More flexible security and expanded testing APIs
Private Modules and Repositories | Deno Docs
Deno, the next-generation JavaScript runtime
March 2 incident update
Deno 1.17 Release Notes
January 4th incident update
Deno 1.29: Custom npm registry support
Deno 1.21 Release Notes
First Steps