Skip to content

[Bug] Headers is not defined #173

@SleeplessOne1917

Description

@SleeplessOne1917

I am running a bot that uses replicate to generate art and I started to encounter this error after upgrading to the latest version:

Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]: ReferenceError: Headers is not defined
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at Replicate.request (/home/insomnia/lemmy-art-bot/node_modules/.pnpm/[email protected]/node_modules/replicate/index.js:194:21)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at Replicate.createPrediction (/home/insomnia/lemmy-art-bot/node_modules/.pnpm/[email protected]/node_modules/replicate/lib/predictions.js:27:27)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at Replicate.run (/home/insomnia/lemmy-art-bot/node_modules/.pnpm/[email protected]/node_modules/replicate/index.js:113:43)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at generateArt (/home/insomnia/lemmy-art-bot/bot.ts:32:13)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at Object.<anonymous> (/home/insomnia/lemmy-art-bot/bot.ts:94:29)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at Generator.next (<anonymous>)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at /home/insomnia/lemmy-art-bot/bot.ts:8:71
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at new Promise (<anonymous>)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at __awaiter (/home/insomnia/lemmy-art-bot/bot.ts:4:12)
Dec 19 00:46:57 lemmygrad-art-bot pnpm[658]:     at Object.mention [as handle] (/home/insomnia/lemmy-art-bot/bot.ts:63:20)

Here is the function in my code that uses replicate:

const generateArt = (prompt: string) =>
  replicate.run(
    'ai-forever/kandinsky-2.2:ea1addaab376f4dc227f5368bbd8eff901820fd1cc14ed8cad63b29249e9d463',
    {
      input: {
        prompt,
        width: 768,
        height: 768,
        num_outputs: 3,
      },
    },
  );

I am using this with Node v20.10.0 and am not overriding the fetch function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions