FlowiseAI / Flowise

Drag & drop UI to build your customized LLM flow
https://flowiseai.com
Apache License 2.0
27.18k stars 14k forks source link

fetch is not defined[BUG] #2655

Open LandonZ opened 2 weeks ago

LandonZ commented 2 weeks ago

Describe the bug When upserting using the Custom JS Document Loader, I get the following error:

Error: ReferenceError: fetch is not defined at CustomDocumentLoader_DocumentLoaders.init (/usr/local/lib/node_modules/flowise/node_modules/flowise-components/dist/nodes/documentloaders/CustomDocumentLoader/CustomDocumentLoader.js:135:19) at async buildFlow (/usr/local/lib/node_modules/flowise/dist/utils/index.js:445:36) at async upsertVector (/usr/local/lib/node_modules/flowise/dist/utils/upsertVector.js:114:32) at async Object.upsertVectorMiddleware (/usr/local/lib/node_modules/flowise/dist/services/vectors/index.js:9:16) at async createInternalUpsert (/usr/local/lib/node_modules/flowise/dist/controllers/vectors/index.js:28:29) 2024-06-17 11:57:38 [ERROR]: [server]: Error: Error: ReferenceError: fetch is not defined Error: Error: ReferenceError: fetch is not defined at buildFlow (/usr/local/lib/node_modules/flowise/dist/utils/index.js:493:19) at async upsertVector (/usr/local/lib/node_modules/flowise/dist/utils/upsertVector.js:114:32) at async Object.upsertVectorMiddleware (/usr/local/lib/node_modules/flowise/dist/services/vectors/index.js:9:16) at async createInternalUpsert (/usr/local/lib/node_modules/flowise/dist/controllers/vectors/index.js:28:29)

To Reproduce Steps to reproduce the behavior:

Run flowise with npx and create a simple flow using Custom Document Loader & Vector Store, using fetch() function in JS.

Expected behavior Upsert working with no error

Screenshots

Screenshot 2024-06-17 at 12 01 58 PM Screenshot 2024-06-17 at 12 04 12 PM

Flow Problem Chatflow.json

Setup

Additional context I have the newest version of Node.js and also installed fetch with "npm install node-fetch" and fetch still appears as not defined for me.

HenryHengZJ commented 1 week ago

did you import node-fetch in the JS function?

const fetch = require('node-fetch');