optic
optic copied to clipboard
hrtime permission is not a thing in Deno 2.0
Looks like there are checks for a removed permission that fail now in Deno 2.0:
error: Uncaught (in promise) TypeError: The provided value "hrtime" is not a valid permission name
(await Deno.permissions.query({ name: "hrtime" })).state === "granted";
^
at Permissions.querySync (ext:runtime/10_permissions.js:211:13)
at Permissions.query (ext:runtime/10_permissions.js:203:34)
at https://deno.land/x/[email protected]/utils/numberFormatter.ts:3:27
I was using:
$ deno --version
deno 2.0.0 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.13-rusty
typescript 5.6.2
console.log(Deno.version)
import { Logger } from "https://deno.land/x/optic/mod.ts";
const logger = new Logger();
logger.info("Hello world!");
Generates following output/error
{ deno: "2.0.0", v8: "12.9.202.13-rusty", typescript: "5.6.2" }
Stack trace:
TypeError: The provided value "hrtime" is not a valid permission name
at Permissions.querySync (ext:runtime/10_permissions.js:211:13)
at Permissions.query (ext:runtime/10_permissions.js:203:34)
at https://deno.land/x/[email protected]/utils/numberFormatter.ts:3:27
Thanks both. I'm currently working on migrating this library to Deno 2 and JSR.
@cknight Thanks and appreciate for all the work, really. I tested it is working with deno 2.0.6.
hint for others
- run with reload to recache optic with newer version as follows:
- deno run -A --reload bin.ts
- where bin.ts has below code
// bin.ts
import { Logger } from "https://deno.land/x/optic/mod.ts";
// or
// import { Logger } from "jsr:@onjara/optic/logger";
const logger = new Logger();
logger.info("Hello world!");