cknight
cknight
DDeno
Created by oldmanfleming on 4/7/2024 in #help
Deno KV: How to query for all records that have been updated since a given timestamp?
Yes, unless the number of records is very small, you'd want the timestamp as part of the keys so that you can do a list on it starting at a given timestamp. This could be a secondary index key or even a primary key where you "delete and set with new timestamp" atomic transaction each time the entry gets updated. However, as you mention, a secondary index may work best depending on your exact use case.
3 replies
DDeno
Created by Kevin on 4/7/2024 in #help
Cannot find module '@alloc/quick-lru'
See https://github.com/denoland/deno/issues/21884. You can try deleting node_modules and running again.
3 replies
DDeno
Created by Mark G on 3/18/2024 in #help
Is there a way to obtain Deno.cron schedule info?
I don't think there's anything locally. For Deploy you could hook into their unofficial API: https://dash.deno.com/projects/your-deploy-project-name/cron?_data_ using token=<your_deno_api_token> cookie.
4 replies
DDeno
Created by octo3. on 3/18/2024 in #help
Is there a way to specify a range and list from KV?
There's also the getMany interface to get multiple keys at once. https://deno.land/api@v1.41.3?s=Deno.Kv&unstable=&p=prototype.getMany
5 replies
DDeno
Created by octo3. on 3/18/2024 in #help
Is there a way to specify a range and list from KV?
You want the list interface. Here's how it might look:
const entries = await Array.fromAsync(kv.list({start: ["parent", 1], end: ["parent", 3]});
const entries = await Array.fromAsync(kv.list({start: ["parent", 1], end: ["parent", 3]});
5 replies
DDeno
Created by it's em! on 3/18/2024 in #help
Drop permissions
Then on the command line you can just do:
deno task start
deno task start
5 replies
DDeno
Created by it's em! on 3/18/2024 in #help
Drop permissions
You can also setup a deno task in your deno.json and specify specific permissions there. E.g. in your deno.json you have:
{
"tasks": {
"start": "deno run --allow-read=./config.json,./my.db --allow-write=./my.db mod.ts",
},
}
{
"tasks": {
"start": "deno run --allow-read=./config.json,./my.db --allow-write=./my.db mod.ts",
},
}
5 replies
DDeno
Created by Pitanga on 3/17/2024 in #help
New fresh project comes out of the box with errors
Also just noticed that you are on VSCodium. If none of the above suggestions work, check to see if it works in VSCode, as this is the only 'officially' supported IDE for the LSP.
10 replies
DDeno
Created by Pitanga on 3/17/2024 in #help
New fresh project comes out of the box with errors
Hmm. I'll assume you haven't changed the deno.json file created. In which case, try restarting the language server (Deno: Restart Language Server command in VS code) and/or restarting VS Code. I've just upgraded to 1.41.3 and have the same import as you without issue. Finally, check you have the latest LSP extension installed (I'm running v3.35.1).
10 replies
DDeno
Created by Pitanga on 3/17/2024 in #help
New fresh project comes out of the box with errors
I don't think so, but it will be much slower. Locally (with tailwind integrated) it 'just works' and is very fast without any additional configuration.
10 replies
DDeno
Created by Pitanga on 3/17/2024 in #help
New fresh project comes out of the box with errors
You can see in your console that the Fresh project started OK, thus the error you are seeing is in VS Code. It looks like you haven't installed or enabled the Deno LSP plugin.
10 replies
DDeno
Created by Pitanga on 3/17/2024 in #help
New fresh project comes out of the box with errors
If you init a project with Tailwind, it comes integrated via npm specifiers and node_modules.
10 replies
DDeno
Created by dzhv.io on 3/16/2024 in #help
Is there a way to write a Deno.AtomicCheck that succeeds for any non-null versionstamp?
Not as a one step transaction. Your best bet is to first kv.get, capture the version stamp, manually validate it's not null then use it as a check in an atomic transaction.
3 replies
DDeno
Created by A person on 3/15/2024 in #help
Caching results from API
I'd use KV to store the cached entry (assuming data is always less than 64kb). When a request gets the data from KV, if it isn't there, then call the API and store the value. You can use Deno cron to call the API every 24 hours:
Deno.cron("Call API every day at 1am", "0 1 * * *", async () => {
const result = await callApi();
await kv.set(["myAPICache"], result);
});
Deno.cron("Call API every day at 1am", "0 1 * * *", async () => {
const result = await callApi();
await kv.set(["myAPICache"], result);
});
11 replies
DDeno
Created by Sheik on 3/12/2024 in #help
What to do if they are attacking a project of mine?
This is great to hear, thanks for sharing. I think people have significant concerns as there is no public policy or recognition from Deno around this and users feel it's on them to take the risk and impact of a DoS attack, while frustrated that this doesn't appear to be a priority. Publicly recognising the issue and documenting the above (a DoS policy and potential roadmap) would go a long way towards giving people more confidence on this subject. Finally, in lieu of your own option 3 WAF/DoS protection, official documentation (or link to the existing article above) on setting up such protection via other providers like Cloudflare would again boost confidence. Many folk are likely unaware of that possibility or unable to configure it on their own without help/documentation. Keep up the great work!
22 replies
DDeno
Created by Sheik on 3/12/2024 in #help
What to do if they are attacking a project of mine?
fair enough, just highlighting that by delivering billing/usage caps, its a first step and public recognition of the issue.
22 replies
DDeno
Created by Sheik on 3/12/2024 in #help
What to do if they are attacking a project of mine?
@Mark G FYI
22 replies
DDeno
Created by Ayfri on 3/11/2024 in #help
How to modify HTTP cache folder
You can change the cache directory with the DENO_DIR environment variable. See https://docs.deno.com/runtime/manual/basics/env_variables#special-environment-variables for more info.
5 replies
DDeno
Created by fred on 3/8/2024 in #help
deno oak : howto force reply immediatly, and process the request later ?
The general idea is to kick off an async process without awaiting it and immediately return after the start of that async process. The async process should continue running after the response is returned. You could also use queueMicrotask(() => {}) or setTimeout(() => {}, 0) to put code on the event loop which could, if done correctly, execute after the response is returned. I'm not familiar with Oak however and if it awaits anything during returning of the response (which might then process the event loop ahead of the response being returned to the client).
4 replies
DDeno
Created by DNA on 3/2/2024 in #help
Puppeteer: "BadResource: Bad resource ID" on Ubuntu
That was going to be my next suggestion. @lino-levan any thoughts?
65 replies