Error fetching Recipe Search Template with edamam....
# 🤝help
b
Error executing action "inline-ins-c9e62a09eb.js" in flow:Main:node:process-api-data [TypeError, Cannot read properties of undefined (reading 'map')]" and the code Im using in call api node is: "async function getRecipes() { const baseUrl = 'https://api.edamam.com/api/recipes/v2'; const query = 'workflow.baseQuery'; // Replace this with your actual search query const apiKey = 'ddbe29a17e2a016c0e1ee8e707bfcee4'; // Replace this with your Edamam API key const number = '3'; const ignorePantry = 'false'; const sort = 'popularity'; const sortDirection = 'asc'; const addRecipeInformation = 'true'; const addRecipeNutrition = 'false'; const url = ${baseUrl}?q=${query}&apiKey=${apiKey}&number=${number}&ignorePantry=${ignorePantry}&sort=${sort}&sortDirection=${sortDirection}&addRecipeInformation=${addRecipeInformation}&addRecipeNutrition=${addRecipeNutrition}; try { const response = await axios.get(url); if (response.status === 200) { const recipeInfo = response.data.results; // Save the recipeInfo to the desired location, e.g., a variable or a file workflow.recipeInfo = recipeInfo; console.log('Recipes retrieved and saved successfully:', recipeInfo); } else { console.log('Failed to retrieve recipes:', response.statusText); } } catch (error) { console.log('An error occurred:', error.message); } } // Run the action with await await getRecipes();
c
We can't go back and forth in the general channel. So I'll make sure your issue can be addressed here.
@early-train-33247 would you mind taking a look, when you're free? thanks
b
ok Thanks Sabrina
a a For the sake of clarification, Im using recipe search premade template and using new code generated from chatbot for edamam.com api instead of spoonacular but Im reciving following error and more one thing I didn't change second code on node "process api". Check your premade template for second code. and first code and error I pasted in my upper message. Please procvide me edited code that work with edamam.com api
c
Thanks for your patience! We have a lot of message to go through on a daily basis.
In the meantime, I would recommend checking this video to troubleshoot API calls:

https://youtu.be/F6L1A8sPznc

e
Hello @bulky-traffic-17808, what is happening is that the recipeInfo variable expects to receive a list (an array []), and response.data.results retrieved from the edaman api is not a list!
As you can see in the Edaman api docs, the recipe results are available in response.data.hits instead

https://cdn.discordapp.com/attachments/1138346241097465949/1138610076538634323/image.png

But I would recommend you using Spoonacular, otherwise you are going to have to update too much stuff in your bot logic!
b
settingsok but spoonacular also doing problem, they show carosels in playground but when we publish and use preconfgure code it doesnt show results, I saw other threads people are also complaining about it.
e
Hey @bulky-traffic-17808, sorry for the late reply! That's not a Spoonacular problem, we are having issues with Carousels.
I would suggest you going back to Spoonacular as it will be easier to debug any problems you might be facing
2 Views