Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno support #708

Open
peterpeterparker opened this issue Apr 10, 2023 · 1 comment
Open

Deno support #708

peterpeterparker opened this issue Apr 10, 2023 · 1 comment

Comments

@peterpeterparker
Copy link
Member

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/[email protected]/lib/cjs/identity/delegation.d.ts"
      const ret = new Error(getStringFromWasm0(arg0, arg1));
                  ^
    at __wbg_new_8d2af00bc1e329ee (https://deno.land/x/[email protected]/eszip_wasm.generated.js:312:19)
    at <anonymous> (https://deno.land/x/[email protected]/eszip_wasm_bg.wasm:1:79439)
    at <anonymous> (https://deno.land/x/[email protected]/eszip_wasm_bg.wasm:1:1388039)
    at <anonymous> (https://deno.land/x/[email protected]/eszip_wasm_bg.wasm:1:1862894)
    at __wbg_adapter_18 (https://deno.land/x/[email protected]/eszip_wasm.generated.js:146:6)
    at real (https://deno.land/x/[email protected]/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/[email protected]/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" } },
  )
})
@krpeacock
Copy link
Contributor

Verified still not working in Feb '24. Unfortunately, I don't think we can fix this until we replace the borc dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants