Patrick (he/him)
Patrick (he/him)
DDeno
Created by Patrick (he/him) on 7/12/2023 in #help
deno check: Module '"internal:///missing_dependency.d.ts"' has no exported member...
The sequence of events: - Upgraded to Deno 1.35.0 - ran deno check on my code - got an error like the one described in https://github.com/denoland/deno/issues/11196 (AssertionError: data unexpectedly null) - tried the suggestion from that issue, namely replaced path with types in my triple slash reference comments - reran deno check - got the above error, the exported member being something that is declared in a file referenced by one of the above triple slash comments Can provide more details and create a GitHub issue but wanted to post here in case folks are already on it.
16 replies
DDeno
Created by Patrick (he/him) on 6/1/2023 in #help
Simulating physics collisions across isolates
A bit tangential to Deno, but since Deploy uses v8 isolates, it seems that a multiplayer online game that involves collision detection and resolution that runs on Deploy would need to do things a bit differently. Wondering if anyone out there has delved into this before and wouldn’t mind sharing their discoveries?
49 replies
DDeno
Created by Patrick (he/him) on 5/26/2023 in #help
How are deno processes/isolates managed in Deploy?
Hi, I'm writing a multiplayer game in Deno and currently all of the game state is kept in module-scoped objects, there's no database or any other form of persistence, yet. It all works as expected when I'm developing locally, but sometimes when testing in Deno Deploy, it's as if there's multiple instances of the game running and which one I'm connecting to is random (using the same URL.) Does Deploy create multiple simultaneous isolates for the same deployment? Is the only solution to implement external storage and make that the source of truth?
21 replies
DDeno
Created by Patrick (he/him) on 5/25/2023 in #help
How to use chrome devtools / inspector with Deno?
Hello all! I'd like to profile my game server written in Deno to identify the hot spots. I see that https://github.com/denoland/deno/pull/4484 was closed, but having trouble pulling up info on how to use it. I've tried running my server with the --inspect flag, opened the chrome's Nodejs inspector, added localhost:8000, but it doesn't connect to/recognize the server process. Any advice? Thanks in advance x 1000
8 replies
DDeno
Created by Patrick (he/him) on 4/13/2023 in #help
cli/tsc crashes with Uncaught TypeError
Using latest Deno (1.32.4), this only happens on certain files, but it effectively means that I cannot do type checking with Deno now. The error (somewhat opaque since this looks like generated code):
error: Uncaught TypeError: Cannot read properties of undefined (reading 'kind')
at <anonymous> (internal:deno_tsc/tsc/00_typescript.js:19111:18)
error: Uncaught TypeError: Cannot read properties of undefined (reading 'kind')
at <anonymous> (internal:deno_tsc/tsc/00_typescript.js:19111:18)
6 replies
DDeno
Created by Patrick (he/him) on 4/11/2023 in #help
Smoother DX using 3rd party modules written in TypeScript in the Browser
Say, for instance, I want to use the "async" standard library's Deferred implementation in some code that runs in the Browser. Currently I manually copy the TypeScript source to a vendor folder and have my build step do the transpilation, then have my import map point to the transpiled code. Is there a way to have Deno or a complimentary tool do the transpiling with less manual intervention and allow a developer to use the original URL for the TypeScript module in their import map? [Aside: wasn't quite sure whether to post this in #help or #ideas . Kinda straddles the line to me 🤷🏻‍♂️ ]
7 replies
DDeno
Created by Patrick (he/him) on 3/13/2023 in #help
Update sub-directory for module already added to deno.land/x
The title pretty much says it all, but the module in question is hot_mod, and the current subdir is src/modules but I want to change it to '' (empty string)
5 replies
DDeno
Created by Patrick (he/him) on 3/12/2023 in #help
Publishing to deno.land/x: GitHub webhook says it's delivered?
I followed these directions (https://deno.land/add_module) to publish a 3rd party module to deno.land/x. On GitHub, the most recent run of the webhook, I've got a 200 response with:
{"success":true,"data":{"module":"hot_mod_server","version":"v0.0.1","repository":"patreeceeo/hot_deno","status_url":"https://deno.land/status/9af0c7c9-0ee4-499d-9ada-d3a27e6ccc15"}}
{"success":true,"data":{"module":"hot_mod_server","version":"v0.0.1","repository":"patreeceeo/hot_deno","status_url":"https://deno.land/status/9af0c7c9-0ee4-499d-9ada-d3a27e6ccc15"}}
But when I search for hot_mod_server on deno.land/x it's not coming up. Also deno info https://deno.land/x/hot_mod_server is failing to find it.
2 replies
DDeno
Created by Patrick (he/him) on 3/9/2023 in #help
WebSocket subprotocols
This might be a bug: Deno's websocket implementation seems to have issues with subprotocols (RFC section on subprotocol). I was using one initially, then I removed it and that issue seems to be resolved. With the subprotocol, since the one returned by Deno.upgradeWebSocket does not include the sec-websocket-protocol header, and response headers are immutable, I was instantiating a new Response instance, copying over data from the response returned by upgradeWebSocket and adding the sec-websocket-protocol header. Even then, the websocket in Deno never opened and all of its properties including readyState would remain undefined indefinitely. The browser was happy, though: its websocket instance's open event was firing, only the server never could use its websocket instance. I removed the subprotocols parameter to the websocket constructor and the code on the server handing it and now the server's websocket is opening and messages are flowing. server:
import { serve } from "http";

serve((request) => {
if (request.headers.get("sec-websocket-protocol") === "esm-hmr") {
const { socket, response } = Deno.upgradeWebSocket(request);
// <Do stuff with socket>

// Create new response with proper headers
return new Response(null, {
status: response.status,
statusText: response.statusText,
headers: {
connection: response.headers.get("connection")!,
"sec-websocket-accept": response.headers.get("sec-websocket-accept")!,
upgrade: response.headers.get("upgrade")!,
"sec-websocket-protocol": "esm-hmr"
}
})
} else {
return new BadRequestResponse()
}
})
import { serve } from "http";

serve((request) => {
if (request.headers.get("sec-websocket-protocol") === "esm-hmr") {
const { socket, response } = Deno.upgradeWebSocket(request);
// <Do stuff with socket>

// Create new response with proper headers
return new Response(null, {
status: response.status,
statusText: response.statusText,
headers: {
connection: response.headers.get("connection")!,
"sec-websocket-accept": response.headers.get("sec-websocket-accept")!,
upgrade: response.headers.get("upgrade")!,
"sec-websocket-protocol": "esm-hmr"
}
})
} else {
return new BadRequestResponse()
}
})
client:
const socket = new WebSocket(socketURL, "esm-hmr");
const socket = new WebSocket(socketURL, "esm-hmr");
5 replies