D
Deno

help

importing packages breaks types

Llvin2/10/2023
Im importing Receiver from https://deno.land/x/upstash_qstash@v0.3.2. but as soon as i import this package my types are borked
IioB2/10/2023
this is quite strange, can you reproduce this in one file? (I would try myself but am in a bus)
Llvin2/10/2023
here is all the code
import { Status } from "https://deno.land/std@0.177.0/http/http_status.ts";
import { Application, Router } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { loadManifest } from "./manifestloader.ts";
import { Receiver } from "https://deno.land/x/upstash_qstash@v0.3.6/mod.ts";

const app = new Application();
const router = new Router();

router.get("/items/:itemType", async (ctx) => {
const name = `${ctx.params.itemType}.json`;
const jsonFiles = [];
for await (const path of Deno.readDir("./assets")) {
jsonFiles.push(path.name);
}
for (const file of jsonFiles) {
if (file === name) {
const fileName = `assets/${name}`;
console.log(file, fileName);
ctx.response.status = 200;
ctx.response.headers.set("Content-Type", "application/json");
ctx.response.body = JSON.parse(await Deno.readTextFile(fileName));
}
}
ctx.response.status = Status.NotFound;
});

router.get("/process-manifest", async (ctx) => {
const token = ctx.request.headers.get("authorization");
if (token === "123") {
ctx.response.status = Status.Unauthorized;
ctx.response.body = JSON.stringify({ error: "unauthorised" });
return;
}
await loadManifest().then(() => {
ctx.response.status = 200;
ctx.response.body = JSON.stringify({ message: "success" });
});
});

app.use(router.routes());
await app.listen({ port: 8000 });
import { Status } from "https://deno.land/std@0.177.0/http/http_status.ts";
import { Application, Router } from "https://deno.land/x/oak@v11.1.0/mod.ts";
import { loadManifest } from "./manifestloader.ts";
import { Receiver } from "https://deno.land/x/upstash_qstash@v0.3.6/mod.ts";

const app = new Application();
const router = new Router();

router.get("/items/:itemType", async (ctx) => {
const name = `${ctx.params.itemType}.json`;
const jsonFiles = [];
for await (const path of Deno.readDir("./assets")) {
jsonFiles.push(path.name);
}
for (const file of jsonFiles) {
if (file === name) {
const fileName = `assets/${name}`;
console.log(file, fileName);
ctx.response.status = 200;
ctx.response.headers.set("Content-Type", "application/json");
ctx.response.body = JSON.parse(await Deno.readTextFile(fileName));
}
}
ctx.response.status = Status.NotFound;
});

router.get("/process-manifest", async (ctx) => {
const token = ctx.request.headers.get("authorization");
if (token === "123") {
ctx.response.status = Status.Unauthorized;
ctx.response.body = JSON.stringify({ error: "unauthorised" });
return;
}
await loadManifest().then(() => {
ctx.response.status = 200;
ctx.response.body = JSON.stringify({ message: "success" });
});
});

app.use(router.routes());
await app.listen({ port: 8000 });
Llvin2/10/2023
its not only specific to that one file
Llvin2/10/2023
importing it anywhere breaks it
Aabi2/11/2023
But what do they error messages actually say?

Looking for more? Join the community!

Recommended Posts
Bug report: deno.land website returns a 500 error for JS filesOn https://deno.land, I noticed that the Node vs Deno comparison didn't seem to do anything. From Deno stopps at file.read()I am currently working on a way to communicate with a COM device. I can successfully open and read f[Resolved][Fresh] How to load data asynchronously after rendering a page ?Hi ! I was wondering if someone could help me understand the paradigm to load data asynchronously afSupabase Auth UI in FreshI'm building a simple web. I'd like to use Supabase's Auth UI, namely the `Auth` component, for handAny tool that will complie my TS code to JS?I have coded a website in typescript using Deno, but I want to convert it to JS code. I know the DenHow to get remote IP address when using Deno.serve?I'm using connInfo when using Deno from STD but the native http server doesn't seem to have such intTwo questions on documentationRTFM in 3... 2... 🙂 Question 1: How do i hide documentation for specific exports, i do not want Is there any simple way to keep track of the heap/stack usage of a running Deno application?I have made a Deno application and I'm curious to know if there's heap/stack issues that I should fiusing data from one deno bench in anotheris there any good way to re-use the results generated in one deno bench in another one? example: `docker compose up of Oak server throws: SyntaxError: Duplicate export of 'type'I am just learning how to use Docker, and am trying to put up a container of an Oak server. When runPublishing Deno Module with Bin (Answered)I know there's a way to include a `bin/` when publishing a module and then perform some kind of `denUse local tgz file instead of tgz from npm registryHello, Is it possible to reference a local tgz file inside a deno project (like calling `npm instalvscode LSP being a disgraceful little bitchfor no reason obvious to me, vscode and deno's lsp has been acting up lately. any ideas what could bIs there a way to fetch() with headers, WITHOUT forcing header keys to lowercase?Title. I'm trying to create an API wrapper for a service which uses "Incapsula" as their firewall or