weaviate / typescript-client

Official Weaviate TypeScript Client
https://www.npmjs.com/package/weaviate-client
BSD 3-Clause "New" or "Revised" License
57 stars 21 forks source link

realFetch.call is not a function #94

Closed ghost closed 7 months ago

ghost commented 9 months ago

The client doesn't work in AWS lambda environment, runtime is Node.js 18.

A call like:

let batcherVectors = client.batch.objectsBatcher();
...
await batcherVectors.do();

crashes with the following error:

| TypeError: realFetch.call is not a function | at d (.../chatbot/aws/node_modules/.pnpm/isomorphic-fetch@3.0.0/node_modules/isomorphic-fetch/fetch-npm-node.js:8:19) | at Object.post (.../chatbot/aws/node_modules/.pnpm/weaviate-ts-client@1.5.0_graphql@16.8.0/node_modules/weaviate-ts-client/dist/index.mjs:1:5955)

This seems connected to the old issue of isomorphic-fetch: https://github.com/matthew-andrews/isomorphic-fetch/issues/194

Would be nice to use a real fetch in supported environments, like node.js 18 or give us an option to provide a fetch client via parameter to weaviate client.

tsmith023 commented 9 months ago

Hi @alexylabs, I'm afraid that we're currently deep into a developmental sprint on the Python client so there isn't the bandwidth to fix this issue. I like your idea of having the option for a user-provided fetch client but we'd have to be wary of potential security issues associated with this in browser environments. Since Node16 is deprecated, simply using fetch now instead of isomorphic-fetch is the most likely candidate but axios may also be useful since it is now v1

However, since this is likely a large refactoring effort that requires some consideration, it will have to wait until we are able to focus more on the TypeScript client in depth. I'm sorry that your use-case is not supported! I hope it will be soon!