Deno

D

Deno

Chat about Deno, a modern runtime for JavaScript and TypeScript.

Join

Trying to deploy fresh project to deno, and all the JS has 500 errors

Brand new fresh based project which works fine locally. Published to Deploy and no errors - home page loads fine but none of the JS loads... all of it has a 500 in the network tab and if I try open the JS directly I get "An error occurred during route handling or page rendering." Nothing in the deploy logs either... but stuck on what to try next...

How to build/cache deno program ahead of time

Hey folks! New Deno user here, really loving it so far! I've built a service that involves a Worker. The Worker is reponsible for executing some provided code. The Worker is terminated after a timeout if it's taking too long. I have a problem that the Worker always takes too long on the first execution of the program – both right after it's been deployed, or locally when running the test suite. In subsequent executions it's as fast as you'd expect. How can I cache the program ahead of time? I thought thats what deno cache does, as its help string says "Download and compile a module with all of its static dependencies and save them in the local cache, without running any code", but its docs link (https://docs.deno.com/go/cache) redirects to the docs for deno install , and running deno cache on my src/main.ts and src/worker.ts doesn't have any effect on the problem I'm having....

how to install and use framer motion in fresh js

Uncaught (in promise) TypeError: Could not find package 'react' from referrer 'file:///home/work/Documents/fresh/test-app-fresh/node_modules/.deno/framer-motion@12.5.0/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs'. const manifest = (await import(toFileUrl(join(dir, "fresh.gen.ts")).href)) ^ at async dev (https://deno.land/x/fresh@1.7.3/src/dev/dev_command.ts:38:21) at async file:///home/work/Documents/fresh/test-app-fresh/dev.ts:8:1...

Deno `fetch()` SSRF prevention: Best practices for user-supplied URLs?

What are the best practices for preventing SSRF vulnerabilities when using the fetch() API in Deno, especially when the input URL for fetch() needs to be arbitrarily received from users? I understand that using a whitelist for allowed hosts is a good starting point, but I'm looking for a more comprehensive approach. Are there any specific Deno APIs or techniques to effectively block internal IP addresses, limit URL schemes, prevent DNS rebinding attacks, or handle redirects securely? Any example code snippets would be greatly appreciated!...

Deno in Jupyter Notebook: Run cells with --check

I would like to be able to run cells with --check enabled, like you would with a file deno run --check file.ts. Currently, running cells in Jupyter notebook with the Deno kernel will not check types and will succeed even if there are type errors, just how the default behaviour of deno run is to not check types. I would like cells with type errors to fail when I run them. Is there any way to do this? Thanks!

Deno permissions and security

Hello I see that deno provides allow net and filesystem - how can i restrict these things based on the file and not blanket on the sandbox? I.e. i have my code and user code - i want to restrict user code but allow my code to have access - user code may use apis defined in my code...

Deno.connect failed to read all bytes when connected to smtp #help

After sending "HELLO EXAMPLE.COM" It should receive many lines of text i.e 250 first string 250 second string The reader only returns the first string....

is it possible to use deno std libraries that are "browser compatible" via npm?

hello i am currently working with yarn+vite project for a small website project. i want to use this base64 library: https://github.com/denoland/std/blob/main/encoding/base64.ts in my project, but i'm having trouble figuring out if this is possible through npm: https://github.com/denoland/std/issues/641...

Unable to run Deno plugin within Webstorm

Webstorm version 2024.3.5 Deno plugin version 243.22562.13 My project's deno.json is located in ...
No description

Deno env vars

In a Deno/Fresh app I have a config file that provides access to env vars, however when I try to run my migrations via
deno run --env-file=.env db:migrate:latest
deno run --env-file=.env db:migrate:latest
...

Is there a way to handle permission prompts from a worker?

I would like to give a worker net/import access to any public IP over https, without giving it the ability to bind to any address or access private IP addresses. The docstring for the net property on the deno.permissions worker option says if set to string[], the net permission will be requested with the specified host strings with the format "<host>[:<port>].", and hooking that seems like the easiest way to do this kind of permission filtering logic, but I can't figure out how to.

high memory usage using compiled binary in docker

```# Build stage FROM denoland/deno:2.2.3 AS builder WORKDIR /app COPY . . RUN deno task build...

`ts-match` unable to infer types properly

I'm using the ts-match library to do some pattern matching on an object, and it seems unable to infer most types properly. Perhaps someone has experience with it. My code is https://pastie.io/htxtti.ts and I'm seeing errors left, right, and center. * 1: Type 'unknown' is not assignable to type '[typeString: string | undefined, skipImport: boolean]' * 9: Object literal may only specify known properties, and 'enum' does not exist in type 'Matcher<never, unknown, any, any, unknown>'...

Unable to deploy Next.js following official guide

hi there 👋 one of deno's main selling points over choosing another runtime like bun is that it promises next.js compatibility, but i haven't yet been able to build and deploy a next.js app with deno. I've tried following this guide from deno but cant get it to work. i filed [a bug report with reproduction steps on the deploy_feedback github here....

How Node.js SQLite works on Deno?

Hello, I'm curious how node:sqlite is supported in Deno? Basically you reflect the APIs exposed by Node.js? Or you get/fetch the code from Node.js and compile it to Deno? Because there are open issues in Node.js for SQLite and thought if those will be reflected in Deno once Node.js deploys them.

How to create private packages in deno and not fall into ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING

Hi everyone! Maybe someone already solved this problem, but I could not find any information or "how to" guide, ChatGPT did not help as well. The problem: I have few private repositories in gitlab, all uses deno as runtime, I want to share some duplicated typscript code written in deno (i.e. all imports ends with .ts extension, also present libraries like "jsr:@std/testing/bdd"; ) so it cant just be launched with node. Have decided to move shared code to separate repository and make a npm package from it (keyword is npm here). ...

How to use cron?

I have this test repo on deno deploy: ```js import express from 'express' import { cron } from "https://deno.land/x/deno_cron/cron.ts"; const app = express()...

Running vite and a deno server in workspaces

I want to write "deno task dev" and it will then start both the frontend (written with vite) and the deno backend at the same time. the closest i got was this: ```json {...

Instancing Rust Structs in JS and maintaining a list of them in Rust

I am struggling to create an extensions for deno_core that would allow me to create Rust Struct instances via JavaScript, but maintain those instances in Rust. What I mean is this: I have a Rust Struct called Rect that I use as a Resource in deno. For the sake of brevity I will reduce its fields in this example to two coordinates, top and left:...

Lume CMS

Hello, I have an issue when I want to deploy Lume CMS with deno deploy. I have my lume CMS storage config set to the src folder and I followed the documentation steps here https://lume.land/cms/deployment/deno-deploy/ the CMS is live but when. I want to edit the data, it doesn't edit in the src folder but in the root folder. Is it normal? Here is my cms file...