anthropics / anthropic-sdk-typescript

Access to Anthropic's safety-first language model APIs
https://www.npmjs.com/package/@anthropic-ai/sdk
MIT License
735 stars 79 forks source link

node 22LTS and punycode #598

Open pelikhan opened 2 weeks ago

pelikhan commented 2 weeks ago

It seems that the SDK has a dep on a deprecated API in node 22LTS. This is the error message I get

(node:16917) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

which after turning tracing looks like it's coming from whatwg-url

@pelikhan ➜ /workspaces/genaiscript (dedup) $ node --trace-deprecation packages/cli/built/genaiscript.cjs run poem
(node:17473) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
    at loadBuiltinModule (node:internal/modules/helpers:114:7)
    at Function._load (node:internal/modules/cjs/loader:1100:17)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:141:16)
    at ../../node_modules/whatwg-url/lib/url-state-machine.js (/workspaces/genaiscript/packages/cli/built/genaiscript.cjs:14681:20)

which seems to be coming from the SDK

@pelikhan ➜ /workspaces/genaiscript (dedup) $ npm ls whatwg-url└─┬ genaiscript-core-internal@1.72.0 -> ./packages/core
  └─┬ @anthropic-ai/sdk@0.30.1
    └─┬ node-fetch@2.7.0
      └── whatwg-url@5.0.0

I might be wrong.