Skip to content

Conversation

@plustokens
Copy link
Contributor

There is a lake of information in replicate documentation regarding nodejs integration:
https://replicate.com/docs/get-started/nodejs

This fix will help to solve "ReferenceError: fetch is not defined" by giving user a way to provide fetch implementation in options object.

@mattt
Copy link
Contributor

mattt commented Apr 10, 2023

Thanks, @plustokens. This matches the documented behavior, where the initializer has a configurable fetch option.

@mattt mattt enabled auto-merge (squash) April 10, 2023 11:07
@harriswong
Copy link

harriswong commented Apr 10, 2023

A quick work around that worked for me is to use node v18. ie. nvm install 18.

@mattt
Copy link
Contributor

mattt commented Apr 10, 2023

A quick work around that worked for me is to use node v18. ie. nvm install 18.

@harriswong You are correct that Node.js 18 includes a native fetch function. There are other reasons that someone might want to configure which fetch to use. Testing is one example. Another is to wrap fetch and add custom headers / caching / retry behavior.

@mattt mattt mentioned this pull request Apr 11, 2023
@mattt mattt merged commit 3b7048b into replicate:main Apr 11, 2023
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

Successfully merging this pull request may close these issues.

3 participants