herenickname
herenickname
DDeno
Created by herenickname on 8/30/2024 in #help
Several commands at once
const command = `
iptables -F
iptables -X
...and more more more...
`
const cmd = new Deno.Command(command)
const { stdout, stderr } = await cmd.output()
const command = `
iptables -F
iptables -X
...and more more more...
`
const cmd = new Deno.Command(command)
const { stdout, stderr } = await cmd.output()
command contains 15 large iptables commands that I want to execute on my local machine. When using the exec() function from the npm:ssh2 package, everything works, but Deno.command returns stderr File name too long (OS error 36) I tried calling /bin/sh and passing the command as an argument, but the error doesn't change. How can I avoid this?
2 replies
DDeno
Created by herenickname on 8/21/2024 in #help
Unexpected behavior while importing npm module
Im trying to use dns2 library in my deno project:
import { Packet } from 'npm:dns2'
import { Packet } from 'npm:dns2'
And I get this error:
& deno run -A --watch src/index.ts
error: Uncaught SyntaxError: The requested module 'npm:dns2' does not provide an export named 'Packet'
& deno run -A --watch src/index.ts
error: Uncaught SyntaxError: The requested module 'npm:dns2' does not provide an export named 'Packet'
But if I import this library in a different way, then everything works:
import dns from 'npm:dns2'
console.log(dns.Packet)
import dns from 'npm:dns2'
console.log(dns.Packet)
Output:
[Function: Packet] {
TYPE: {
...
[Function: Packet] {
TYPE: {
...
What am I doing wrong? Deno v1.44.4
4 replies
DDeno
Created by herenickname on 12/27/2023 in #help
Deno.serve() with SSL cert timeout
I have a very simple script that serves a /ping route. After some time (randomly) it stalls and no new request goes through. main.ts:
import { Hono } from 'https://deno.land/x/hono@v3.11.10/mod.ts'
import { basicAuth, logger } from 'https://deno.land/x/hono@v3.11.10/middleware.ts'

const app = new Hono()

app.use('*', logger())

app.get(
'/ping',
(c) => c.text('pong')
)

const cert = await Deno.readTextFile('/root/fullchain.pem')
const key = await Deno.readTextFile('/root/privkey.pem')

Deno.serve({ port: 443, cert, key }, app.fetch)
import { Hono } from 'https://deno.land/x/hono@v3.11.10/mod.ts'
import { basicAuth, logger } from 'https://deno.land/x/hono@v3.11.10/middleware.ts'

const app = new Hono()

app.use('*', logger())

app.get(
'/ping',
(c) => c.text('pong')
)

const cert = await Deno.readTextFile('/root/fullchain.pem')
const key = await Deno.readTextFile('/root/privkey.pem')

Deno.serve({ port: 443, cert, key }, app.fetch)
curl response:
# curl -v https://localhost
* Trying 127.0.0.1:443...
* Connected to localhost (127.0.0.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* SSL connection timeout
* Closing connection 0
curl: (28) SSL connection timeout
# curl -v https://localhost
* Trying 127.0.0.1:443...
* Connected to localhost (127.0.0.1) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* SSL connection timeout
* Closing connection 0
curl: (28) SSL connection timeout
Can it be caused by something unstable inside Deno.serve?
# deno -V
deno 1.39.1
# deno -V
deno 1.39.1
2 replies
DDeno
Created by herenickname on 12/7/2023 in #help
Linter does not warn about lack of constructor arguments.
No description
9 replies