Leonardo-Interactive / leonardo-ts-sdk

Typescript SDK for Leonardo AI
MIT License
52 stars 16 forks source link

ERR_INVALID_URL for any api requests #79

Open aivanouski opened 5 months ago

aivanouski commented 5 months ago

TypeError: Invalid URL at new NodeError (node:internal/errors:393:5) at URL.onParseError (node:internal/url:565:9) at new URL (node:internal/url:645:5) at default_1 (/project/node_modules/near-api-js/lib/utils/setup-node-fetch.js:20:77) at HTTPClient.DEFAULT_FETCHER [as fetcher] (/project/node_modules/@leonardo-ai/sdk/src/lib/http.ts:18:12) at HTTPClient.request (/project/node_modules/@leonardo-ai/sdk/src/lib/http.ts:63:30) at User.do$ (/project/node_modules/@leonardo-ai/sdk/src/lib/sdks.ts:124:42) at processTicksAndRejections (node:internal/process/task_queues:95:5) at User.getUserSelf (/project/node_modules/@leonardo-ai/sdk/src/sdk/user.ts:83:26) at Website.generateVideo (/project/src/infinite/libs/website.ts:192:18) { input: '[object Request]', code: 'ERR_INVALID_URL' }

const me = await this.leonardo.user.getUserSelf();
      console.log(me);

or

// Generate Image
      const imageGenerationResponse = await this.leonardo.generation.createGeneration({
        height: 768,
        width: 1024,
        numImages: 1,
        prompt: functionCallSettings.functionArgs?.text || 'An ocean wave',
        public: false,
        alchemy: true,
        modelId: '1e60896f-3c26-4296-8ecc-53e2afecc132',
      });
@Inject('LEONARDO')
    private readonly leonardo: Leonardo,
 providers: [
  ..
    {
      provide: 'LEONARDO',
      useFactory: () =>
        new Leonardo({
          serverURL: 'https://cloud.leonardo.ai/api/rest/v1',
          bearerAuth: process.env.LEONARDO,
        }),
    },
  ],

node v18.12.1 yarn 1.22.19 "@leonardo-ai/sdk": "^4.10.1",

aivanouski commented 5 months ago

I have update near-api-js library, and now it works. but it's weird.