Questions tagged [deno]
A secure runtime for JavaScript and TypeScript.
643
questions
0
votes
0
answers
25
views
How can i store an array from js as a column value in postgreSQL?
I need to add an array of string values into postgre but i get this error :
malformed literal array.
This array is taken from a form inside a hidden input value and has a regular array format: ['bla'...
2
votes
2
answers
52
views
What's the correct way to self-host a Deno library?
I've set up an apache2 server and have located my library at http://example.com/lib/deno/test@1.0.0/ and then created a 301 redirect from http://example.com/lib/deno/test/ to the former. In VS Code (...
-1
votes
0
answers
29
views
error: TS2347 [ERROR]: Untyped function calls may not accept type arguments in Deno
Trying to move db stuff to middleware in Oak:
const user = await db.query<any[]>(
"INSERT INTO users (id, email, username, hashed_password, created_at, updated_at, contactme, ...
0
votes
1
answer
36
views
How to stub a constructor from an imported ES6 module?
I would like to stub the constructor of a class within a test file. Say I have the following:
// Foo.js
export class Foo {}
and
// myTestFile.js
import {Foo} from "./Foo.js";
import {...
0
votes
1
answer
64
views
what is the equivalent of Java's System.out.print() in javascript [duplicate]
It seems console.log() is the equivalent of System.out.println()
How to print strings in the same line with multiple calls?
Like:
for (let i=0;i<2;i++){
console.log(i);
}
but print in the same ...
0
votes
0
answers
44
views
What are the Supabase Edge Functions Memory Limits
I created a Supabase Deno Edge Function that works perfectly well inside the Supabase Docker environment on my Mac, but whenever I execute it in production / the cloud I run into this error after a ...
0
votes
0
answers
100
views
global serverless functions callable at specific locations
Is there a service like Deno Deploy or Cloudflare Workers that auto-deploys functions to many locations around the globe and lets developers address/call them at specific locations (not just let users ...
0
votes
0
answers
25
views
DenoDB generic getters to acces data
I'm making a Deno REST API with a database and DenoDB as an ORM
There is approximatively 18 model classes in my app
I need to take care of user authentication in each request, and other repetitive ...
1
vote
1
answer
61
views
Can I run and debug deno project in VSCode?
I'm new to both typescript and deno, also vscode.
Firstly, I tried it with vscode and failed, and then tried with IntelliJ.
I can run and debug simple .ts file in Intellij with deno plugin.
But I want ...
-1
votes
1
answer
140
views
Received a ServerHelloDone handshake message while expecting [CertificateRequest]
I'm getting this error in fetch with Deno:
Received a ServerHelloDone handshake message while expecting [CertificateRequest]
I'm hitting a web api I don't control.
1
vote
1
answer
31
views
How to filter Deno tests based on filename?
How to filter Deno tests based on filename?
For example, I have the following files:
number_1_test.ts
number_2_test.ts
string_test.ts
I want to run number* tests,
I can't use the following command:
...
0
votes
1
answer
39
views
How to determine the location of the deno script? [duplicate]
Let's say I issue the following command:
deno run --allow-read /scripts/where-am-i.ts
What would need to be inside where-am-i.ts for it to output:
/scripts
I've tried:
console.log(Deno.cwd());
...
0
votes
2
answers
29
views
optional parameters when defining routes
I am working on deno equivalent of my node (express) server application for study purposes and I can't find a way to apply optional chunks when defining routes.
For example in express application i ...
0
votes
1
answer
16
views
compilation error at overload when using replacerFunction callback
I have a function that generates random word:
const randomWord = () => {
return "obbooobb".replace(/([ob])/g, (match: string) => {
if (match === "o") {
...
0
votes
1
answer
15
views
Base Class extended Incorrectly
Hey I am using Deno and extending EventTarget class but I don't want the end user to be able to get functions which exist on EventTarget class like addEventListener,dispatchEvent and ...
0
votes
2
answers
24
views
Spread values not being recognized in Create method
Deno has sessionStorage globally available, which is what I'm using as my in-memory database.
I'm working on a method that creates a new museum in sessionStorage. However, the problem is that my ...
1
vote
1
answer
37
views
Create type object in python similar to type object in typescript
How can i create these data types in Python ?
These types were defined in typescript and i want to recreate it in python. How can i do it in python easily and correctly?
export type Category =
'...
0
votes
0
answers
29
views
Run shell builtin/script command from Deno
I sometimes need to execute a built-in shell command like type, or just run an arbitrary shell command string (as a single string rather than an array of command + arguments). While I prefer the API ...
0
votes
1
answer
69
views
How to add router middleware to dynamic Router?
I am trying to add router middleware to my dynamically-generated routes. I want to pass an array of router middleware to my router so that it can attach them to my routes.
A route and/or a group of ...
0
votes
1
answer
36
views
Deno oak v10.5.1 context.cookies never being set
When attempting to set cookies in oak, the cookies property of the context is never changed and the value is always returned undefined even when using the example in their docs.
app.use(async ctx =>...
0
votes
1
answer
20
views
Example file locking in Deno (Deno.flock)
I realize that it's currently unstable, but does anyone have an example of using exclusive file locking with Deno? Or for that matter, how to get/use the resource id for a specific file path.
Deno....
1
vote
1
answer
36
views
How to extend the Response in Opine (Deno framework)?
first question here.
Does anyone know how to extend the response in Opine (Deno framework) so that I can create custom responses?
For example I would like to create:
res.success(message)
So that I ...
0
votes
0
answers
26
views
TransformedProps not a recognized as a type in a Typescript/React project?
I'm getting an error when using an OOTB Material UI component in React18, Deno (TypeScript) and Material UI. Specifically on not finding the TransformedProps type:
https://mui.com/material-ui/react-...
1
vote
1
answer
24
views
Trying to insert an image dynamically to a template fragment
I am trying to insert an image through the backend using a URL pulled from a database and attempting to dynamically display them based on an expense that a user wants to see when they click the how ...
0
votes
1
answer
41
views
There’s no standard specification for JavaScript's backend APIs?
I’m writing an article on JavaScript and a question came up.
JavaScript has Web APIs as its standard specification for the browser.
There’s no standard specification for JavaScript's backend (Node and ...
1
vote
0
answers
75
views
Deno Unstable Flag
I read though puppeteer documentation and ran every require command but when I run the sample code even with the --unstable flag . Deno seem to throw the same error as shown below
$ deno run --...
2
votes
1
answer
212
views
Deno on multi-core machines
In Node.js there is the cluster module to utilize all available cores on the machine which is pretty great, especially when used with the node module pm2. But I am pretty stoked about some features of ...
1
vote
1
answer
41
views
Intl.Segmenter support in Deno
The MDN documentation says that Intl.Segmenter is supported in Deno version 1.8 and above. But when trying to use it, I get an error.
error: TS2339 [ERROR]: Property 'Segmenter' does not exist on type ...
0
votes
1
answer
48
views
Mixin class in Typescript cannot be mocked by Rhum
Hello community I have this code which fails on the last line. Once it is commented out is is passing through as expected. The problem is when mocking the mixin class.
Have somebody any thoughts, ...
0
votes
0
answers
54
views
Why does docker fail to run correct CMD when using .sh script as entrypoint?
I'm relatively new to docker (at least to do more than run images others had built) and I'm stuck on this one. I'm building an app using Deno and trying to get it running in docker. my base image is ...
0
votes
1
answer
50
views
Conditional type property on generic class
why does this not work??
export class Client<isReady extends boolean = false> {
user: isReady extends true ? ClientUser : null = null
}
Deno throws this error Type 'null' is not assignable to ...
1
vote
2
answers
87
views
How To Parse URL in Deno
How do you parse a URL in deno like node.js url.parse()?
0
votes
0
answers
282
views
Object Is possibly 'undefined' in this function
I'm writing a function for a router in Deno which queries data from my database. But I get this error :
error: TS2532 [ERROR]: Object is possibly 'undefined'.
getUser.rowDescription.columns.map((...
0
votes
0
answers
51
views
What is wrong with my findOne() implementation?
I have followed all basic tutorials in search to fix this. My implementation of collection.findOne({_id: ctx.params.id}) is just not working.
// import statements for version transparancy, they are ...
0
votes
0
answers
38
views
Use deno to create windows network drive (using windows dll)
I want to rewrite an old .bat program into Deno compiled app.
I know how to handle most things, but I do struggle with creating network drives. Previously I used code like this:
cmdkey /add:PCName /...
0
votes
1
answer
72
views
Is there anyway working with schemas in Deno?
I am trying to store and work with a similar to following structure data using Deno and MongoDB.
[
{
id: "AAPL",
stockData: [
{ date: 1634601600, summary: [...
0
votes
0
answers
45
views
Is it better to save data as Object of Objects or Array of Arrays of Objects into NoSQL(MongoDB) database?
I have a code like below:
export type Params = NonNullable<ConstructorParameters<typeof URLSearchParams>[0]>;
class AlphaVantage { constructor (protected readonly api: AlaphaVantage) {} }
...
0
votes
1
answer
96
views
Returns an undefined value on a post request
When I make a post request returns - undefined
request:
curl --location --request POST 'http://localhost:8000/api/register?name=Jose&email=email@test.com&password=123456'
--header 'Content-...
0
votes
0
answers
46
views
Deno argument is not assignable problem with djwt [duplicate]
in my project I use djwt - https://github.com/timonson/djwt. the following errors occur when starting the server
error: TS2345 [ERROR]: Argument of type '"secret-key-123435465qwertyuiop"' is ...
0
votes
0
answers
33
views
deno.exe running two processes, unable to stop
I installed deno using choco a few days back. Today my antivirus firewall gave a message that deno.exe is trying to make tcp connections to a remote ip (on Windows 10).
Taskmanager shows two deno.exe ...
0
votes
1
answer
116
views
Generic type RouterContext requires 3 parameters - problem
I'm trying to update the version of the modules in my deno project but after updating them I get the following errors and I don't understand why it happens. has anyone encountered this problem?
error:
...
0
votes
2
answers
50
views
Problems with '--isolatedModules' flag and RouterContext
When trying to run my deno app the following error comes out and I don't understand why .. Has anyone encountered this problem?
run command: deno run --allow-all server.ts
error:
error: TS1205 [ERROR]:...
1
vote
2
answers
84
views
Use Deno.run to extract a file with 7z
Trying to do a little script to automate some tasks. Chose deno as a nice self-contained way to do random automation tasks I need - and a learning opportunity.
One of the things I'm trying to do is ...
-1
votes
1
answer
76
views
Is it possible to use Deno without typescript?
I want to disable typescript when using Deno.
I know I can pass --config .deno but how do I tell the compiler to just support vanilla js and no typescript?
{
"compilerOptions": {
"...
1
vote
1
answer
71
views
How to transfer files via SSH using Deno?
I'm looking for a way to transfer files via SSH using Deno. I'm not trying to allow the user to upload files through a website, instead I want to use Deno as a scripting language to upload files to a ...
0
votes
1
answer
50
views
Untar from a Fetch Reader in Deno
I'm trying to figure why I keep getting the following erorr with this code
[uncaught application error]: Error - checksum error
import { Untar } from "https://deno.land/std@0.128.0/archive/tar....
0
votes
1
answer
62
views
pdfMake in deno from a CDN
I want to use pdfMake in deno and not host the pdfMake files and vfs_fonts on my server, by using a CDN line CDNJS or esm.sh.
I have the following code in the to of my app.js file:
import pdfMake from ...
0
votes
1
answer
83
views
Can't run server with Deno and Servest
I was trying to run a simple server in Deno and typescript but I keep having this error:
error: TS2739 [ERROR]: Type '{ localAddr: { transport: "tcp"; hostname: string; port:
number; }; ...
1
vote
1
answer
141
views
How to convert a Unix timestamp to "2000-01-01" or "2000-05-24 20:00:00" format or reverse in Deno?
I am new in Deno. I want to know how can I convert Unix timestamp like 1646245390158 to 2000-01-01 or 2000-05-24 20:00:00 format or vice versa?
0
votes
1
answer
43
views
Why can't I save the 'id' on MongoDB using Deno backend?
I am trying to save the id that I get from the MongoDB while saving the stock information as a property of stock using the following code but I get some errors:
async save(stock : Stock) {
const ...