Skip to content Skip to sidebar Skip to footer

I'm Getting A 'wrapped Promise Not Iterable Error' Even Though I Have Only One Parameter

I'm trying to use a Promise.all in my node.js microservice. The intent of the Promise.all is to go through all the elements in an array (of queries), and via apolloFetch, calls ano

Solution 1:

The code takes the return value from calling apolloFetch, and unconditionally feeds that to Promise.all.

I think the answer to:

Can someone figure out what I'm doing wrong here

is, you have not allowed for the case when apolloFetch returns something different from an iterable collection.

Instead, call apolloFetch, figure out whether or not the return value is iterable; and only if it is iterable, call Promise.all.

If the apolloFetch returns something other than an iterable, you need to decide how your code should behave. Currently it raises an error, which evidently is not what you want; but you need to decide what you do want in that case.

Post a Comment for "I'm Getting A 'wrapped Promise Not Iterable Error' Even Though I Have Only One Parameter"