Deno support
peterpeterparker opened this issue · comments
Is your feature request related to a problem? Please describe.
I tried to integrate agent-js in a Supabase function which uses Deno but, build failed.
❯ npx supabase functions deploy cron-statuses
Version 1.30.3 is already installed
Bundling cron-statuses
Error: Error bundling function: exit status 1
file:///src/import_map.json
file:///src/index.ts
error: Uncaught (in promise) Error: Relative import path "@dfinity/agent" not prefixed with / or ./ or ../ and not in import map from "https://esm.sh/v114/@dfinity/identity@0.15.5/lib/cjs/identity/delegation.d.ts"
const ret = new Error(getStringFromWasm0(arg0, arg1));
^
at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:312:19)
at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:79439)
at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1388039)
at <anonymous> (https://deno.land/x/eszip@v0.30.0/eszip_wasm_bg.wasm:1:1862894)
at __wbg_adapter_18 (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:146:6)
at real (https://deno.land/x/eszip@v0.30.0/eszip_wasm.generated.js:130:14)
Try rerunning the command with --debug to troubleshoot the error.
For sample code:
import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
import {Ed25519KeyIdentity} from "https://esm.sh/@dfinity/identity";
console.log("Hello from Functions!")
const key = Ed25519KeyIdentity.generate();
console.log("Key", key);
serve(async (req) => {
const { name } = await req.json()
const data = {
message: `Hello ${name}!`,
}
console.log('LOG:', data.message);
return new Response(
JSON.stringify(data),
{ headers: { "Content-Type": "application/json" } },
)
})
Verified still not working in Feb '24. Unfortunately, I don't think we can fix this until we replace the borc
dependency