Open mrvdot opened 5 months ago
Hey there! Thanks for opening this issue. I personally haven't explored Deno much, but this sounds like a potential issue on our end. I'm currently on holidays, but I'll take a look later today. I'm officially back from the holidays on the 3rd of January!
Appreciate it! For now, I was able to work around it with the infisical export
command, but would definitely prefer a cleaner SDK integration
Hey @mrvdot, I pushed an update (1.1.2), that should resolve this issue. Can I have you try again please?
Great, thank you, I'll check it out this weekend!
Hey, so, I'm hitting a new error now, so... #progress :laughing:
I updated my import to be npm:@infisical/sdk@1.1.2
, which resolved the previous error message, but now I have two new problems:
LogLevel
is no longer exported (not a big deal, just noticed because it was included in the SDK example on https://infisical.com/docs/sdks/languages/node)Error: unreachable
at arch (ext:deno_node/_process/process.ts:16:11)
at get arch [as arch] (node:process:301:14)
at Object.<anonymous> (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/@infisical/sdk/1.1.2/binding.js:10:19)
at Object.<anonymous> (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/@infisical/sdk/1.1.2/binding.js:260:4)
at Module._compile (node:module:733:34)
at Module._extensions..js (node:module:747:10)
at Module.load (node:module:658:32)
at Module._load (node:module:539:12)
at Module.require (node:module:677:19)
at require (node:module:791:16)
failed to send request to user worker: connection error: Connection reset by peer (os error 104)
InvalidWorkerResponse: user worker failed to respond
at async Promise.all (index 1)
at async UserWorker.fetch (ext:sb_user_workers/user_workers.js:64:19)
at async Server.<anonymous> (file:///home/deno/main/index.ts:146:12)
at async #respond (https://deno.land/std@0.182.0/http/server.ts:220:18) {
name: "InvalidWorkerResponse"
}
For reference, here is my entire Deno function (with project id removed):
import { InfisicalClient } from 'npm:@infisical/sdk@1.1.2';
Deno.serve(async (req) => {
const client = new InfisicalClient({
clientId: Deno.env.get('INFISICAL_CLIENT_ID'),
clientSecret: Deno.env.get('INFISICAL_CLIENT_SECRET'),
// logLevel: LogLevel.Debug,
});
const data = client.listSecrets({
path: '/api',
environment: 'dev',
projectId: '{PROJECT_ID_HERE}',
});
return new Response(JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
});
Not sure if it's related, but I'd originally tried to use the esm.sh import syntax (since that's what Supabase seems to recommend), but that also includes an error:
https://esm.sh/@infisical/sdk@1.1.2
/* esm.sh - @infisical/sdk@1.1.2 */
import "/v135/node_fs.js";
import "/v135/path-browserify@1.0.1/es2022/path-browserify.mjs";
// THE NEXT LINE CAUSES IT TO FAIL
import "/error.js?type=unsupported-node-builtin-module&name=child_process&importer=@infisical/sdk@1.1.2";
import "/v135/@infisical/napi-android-arm64@latest/es2022/napi-android-arm64.mjs";
import "/v135/@infisical/napi-android-arm-eabi@latest/es2022/napi-android-arm-eabi.mjs";
import "/v135/@infisical/napi-win32-x64-msvc@latest/es2022/napi-win32-x64-msvc.mjs";
import "/v135/@infisical/napi-win32-ia32-msvc@latest/es2022/napi-win32-ia32-msvc.mjs";
import "/v135/@infisical/napi-win32-arm64-msvc@latest/es2022/napi-win32-arm64-msvc.mjs";
import "/v135/@infisical/napi-darwin-universal@latest/es2022/napi-darwin-universal.mjs";
import "/v135/@infisical/napi-darwin-x64@latest/es2022/napi-darwin-x64.mjs";
import "/v135/@infisical/napi-darwin-arm64@latest/es2022/napi-darwin-arm64.mjs";
import "/v135/@infisical/napi-freebsd-x64@latest/es2022/napi-freebsd-x64.mjs";
import "/v135/@infisical/napi-linux-x64-musl@latest/es2022/napi-linux-x64-musl.mjs";
import "/v135/@infisical/napi-linux-x64-gnu@latest/es2022/napi-linux-x64-gnu.mjs";
import "/v135/@infisical/napi-linux-arm64-musl@latest/es2022/napi-linux-arm64-musl.mjs";
import "/v135/@infisical/napi-linux-arm64-gnu@latest/es2022/napi-linux-arm64-gnu.mjs";
import "/v135/@infisical/napi-linux-arm-gnueabihf@latest/es2022/napi-linux-arm-gnueabihf.mjs";
export * from "/v135/@infisical/sdk@1.1.2/es2022/sdk.mjs";
export { default } from "/v135/@infisical/sdk@1.1.2/es2022/sdk.mjs";
Hey @mrvdot, are you able to create a public repo that produces the same issue, so I can clone it on my end? That would be great!
Yeah I'll do that this week
@DanielHougaard Here you go: https://github.com/mrvdot/infisical-deno-test
Let me know if you have any trouble getting it running
Hey @mrvdot, sorry for the delayed follow-up!
Just tried out your repo locally with a new version I just released, and it should now work as expected! If you give 2.0.7 a try, everything should work as expected. Thanks for reporting, and feel free to let me know how it goes!
Great, thank you! I'll check it out this week
Hey @DanielHougaard , I'm still seeing this error when I run it (tried with 2.0.7 and 2.1.3)
Error: unreachable
at arch (ext:deno_node/_process/process.ts:16:11)
at get arch [as arch] (node:process:301:14)
at Object.<anonymous> (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/@infisical/sdk/2.1.3/binding.js:10:19)
at Object.<anonymous> (file:///tmp/sb-compile-edge-runtime/node_modules/localhost/@infisical/sdk/2.1.3/binding.js:303:4)
at Module._compile (node:module:733:34)
at Module._extensions..js (node:module:747:10)
at Module.load (node:module:658:32)
at Module._load (node:module:539:12)
at Module.require (node:module:677:19)
at require (node:module:791:16)
failed to send request to user worker: connection error: Connection reset by peer (os error 104)
Did a little digging and seems like Deno might be the cause: https://github.com/denoland/deno/issues/14579 (or possibly rustls: https://github.com/rustls/rustls/issues/184)
Either way, seems like it's not your fault :laughing: I've got a workaround for now, so no need to press forward, but I appreciate it!
@mrvdot This is very odd, if you get the chance, could I have you try 2.1.8? Thanks!
I'm still seeing the same error, even on 2.1.8. Seems likely this is a deno problem at this stage. Thanks for looking!
Hmmm. Are you running it in a containerized environment? On my end it works 🤔
Unless I'm mistaken, Supabase always runs in a containerized environment. Seems to be confirmed by the logs reporting the error from /home/deno/functions/infisical-test
when my home folder is alex
and that's not the path to my repo
I'm working to integrate Infisical with my Supabase Edge Functions, which all run on Deno. However when I try to import the sdk (via
import { InfisicalClient } from 'npm:@infisical/sdk';
, I get an error thatnpm package '@infisical/sdk-darwin-arm64' does not exist
This is my first time working with Deno, so I'm not positive if this is a package problem or an engine problem, apologies if I should be posting this elsewhere.
Thanks!