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
at async file:///node_modules/.deno/@nestjs+core@10.3.9/node_modules/@nestjs/core/router/router-proxy.js:9:17
6/20/2024, 8:59:58 PM
gcp-us-west2
at async file:///node_modules/.deno/@nestjs+core@10.3.9/node_modules/@nestjs/core/router/router-execution-context.js:46:28
6/20/2024, 8:59:58 PM
gcp-us-west2
at eventLoopTick (ext:core/01_core.js:175:21)
6/20/2024, 8:59:58 PM
gcp-us-west2
at runNextTicks (ext:deno_node/_next_tick.ts:71:3)
6/20/2024, 8:59:58 PM
gcp-us-west2
at processTicksAndRejections (ext:deno_node/_next_tick.ts:53:10)
6/20/2024, 8:59:58 PM
gcp-us-west2
at Object.runMicrotasks (ext:core/01_core.js:642:26)
6/20/2024, 8:59:58 PM
gcp-us-west2
at file:///node_modules/.deno/@nestjs+core@10.3.9/node_modules/@nestjs/core/router/router-execution-context.js:38:29
6/20/2024, 8:59:58 PM
gcp-us-west2
at RedirectController.create (file:///src/controller.ts:30:30)
6/20/2024, 8:59:58 PM
gcp-us-west2
TypeError: Cannot read properties of undefined (reading 'create')
6/20/2024, 8:59:58 PM
gcp-us-west2
[Nest] 2 - 06/21/2024, 3:59:58 AM ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'create')
6/20/2024, 8:59:58 PM
at async file:///node_modules/.deno/@nestjs+core@10.3.9/node_modules/@nestjs/core/router/router-proxy.js:9:17
6/20/2024, 8:59:58 PM
gcp-us-west2
at async file:///node_modules/.deno/@nestjs+core@10.3.9/node_modules/@nestjs/core/router/router-execution-context.js:46:28
6/20/2024, 8:59:58 PM
gcp-us-west2
at eventLoopTick (ext:core/01_core.js:175:21)
6/20/2024, 8:59:58 PM
gcp-us-west2
at runNextTicks (ext:deno_node/_next_tick.ts:71:3)
6/20/2024, 8:59:58 PM
gcp-us-west2
at processTicksAndRejections (ext:deno_node/_next_tick.ts:53:10)
6/20/2024, 8:59:58 PM
gcp-us-west2
at Object.runMicrotasks (ext:core/01_core.js:642:26)
6/20/2024, 8:59:58 PM
gcp-us-west2
at file:///node_modules/.deno/@nestjs+core@10.3.9/node_modules/@nestjs/core/router/router-execution-context.js:38:29
6/20/2024, 8:59:58 PM
gcp-us-west2
at RedirectController.create (file:///src/controller.ts:30:30)
6/20/2024, 8:59:58 PM
gcp-us-west2
TypeError: Cannot read properties of undefined (reading 'create')
6/20/2024, 8:59:58 PM
gcp-us-west2
[Nest] 2 - 06/21/2024, 3:59:58 AM ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'create')
6/20/2024, 8:59:58 PM
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
Deno AI Helper
Deno AI Helper6mo ago
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.
uptownhr (James)
uptownhr (James)OP6mo ago
@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.
Deno AI Helper
Deno AI Helper6mo ago
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.