Function Block API Limitations
What are you looking to achieve:
I'm trying to build a chatbot that fetches images from external APIs (Unsplash) using a Function Block. The goal is to take user input, make an API call to https://api.unsplash.com/search/photos, and return the image URL to display in an Image Block.
What the issue is:
Function Block consistently fails when trying to make external API calls with fetch(). I'm getting these specific errors:
"response.json is not a function"
"response.text is not a function"
Even basic fetch operations that work perfectly in browser/Node.js environments fail in Voiceflow Function Block. The API call itself seems to execute (no network errors), but response parsing methods are not available.
Solutions that you've already tried:
Standard approach: const response = await fetch(url); const data = await response.json(); → Failed
Alternative parsing: const text = await response.text(); const data = JSON.parse(text); → Failed
Different API: Switched from Unsplash to Pixabay API → Same errors
API Block alternative: Used native API Block but it returns 0 despite "succeeded" status
Code verification: Same exact code works in external JavaScript environments
Question:
Are there known limitations with external API calls in Function Blocks, particularly in Trial accounts? Are methods like response.json() and response.text() restricted in the Voiceflow execution environment?
Any guidance on proper external API integration would be appreciated.
0 Replies