Skip to main content
Question

Array Error and ID Error Won't Go Away

  • May 5, 2023
  • 1 reply
  • 19 views

charlotte_anne

Hi all,

 

I'm attempting to handle a response from my company's api that I'm getting through Zapier. Our api returns {"status":"SUCCESS","description":"","result": etc. etc.

I'm getting 2 error messages

1. Results must be an array

2. Got a result missing the "id" property

 

I have tried this as a solution based on other conversations I saw on here.

 

return z.request(options)

  .then((response) => {

    //response.throwForStatus();

    // You can do any parsing you need for results here before returning them

    const myJson = response.json;

    const justResults = myJson.result;

    const results = [justResults];

    //results.throwForStatus();

    return results;

  });

 

I would expect this to work because results contains an id field, and I'm returning an array. I'm still getting those error messages even though I've refreshed my logs. Does anyone know what's causing this? I'm still getting:

 

- Results must be an array, got: object, ({"status":"SUCCESS","description":"","result":{"la) 

- Got a result missing the "id" property ("SUCCESS")

 

Thanks,

Did this topic help you find an answer to your question?

1 reply

charlotte_anne

For some reason this seems to have worked for me:

 

return z.request(options)
  .then((response) => {
    //response.throwForStatus();
    // You can do any parsing you need for results here before returning them
    z.console.log('response');
    z.console.log(response);
   return [response.json.result]
  });