Question

"Got a non-object result" error when testing a Zap

  • 5 January 2020
  • 2 replies
  • 1576 views

Userlevel 1

We are building our first app integration with Dynamic Fields, but are getting a "Got a non-object result" error message when testing the Zap that uses the integration...

image.pngThe app Action integration is set up like this...

Notice that the "results" we return are the response.headers as a JSON String (see 2nd image below). That's because if we parse the response.headers first, when we test the below Zapier complains that we did not return a string (see 1st image below).


We get an "[object Object]" is not a String ERROR if we parse the headers and return an OBJECT...

image.png

We return a STRING... (the response.headers as JSON), we get no error on this step. BUT... in the Zap shown at the top of this post we get the "Got a non-object response' error.

image.pngThus one step requires us to return a STRING, then the next step demands an OBJECT.

What are we conceptually missing? What are we doing wrong? What do we need to do do get this working?

Thanks for your help!



This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 4
Badge +4

@khakman A couple comments/things to try:

  • JSON.parse is a very literal and syntax sensitive function, this makes it very temperamental if you don't have a perfectly formatted string. My guess is that it can't handle the '_headers' as your initial object value and it doesn't like the single quotes (') instead of double quotes("). (The single quotes could just be how it's being printed in Zapier logs.)
  • Your getting the Non-Object response for a similar reason. Zapier backend takes in your returned object and parses it to display the different key:value pairs in the object as items you can select in the front end. Zapier is failing to parse your header object and is giving you the error.

The issue you need to fix is that although response.headers is an object the syntax/formatting of it can not be parsed. Which leaves you with the following options to correct it:

  • return response.headers['_headers'] and see if that fixes the error
  • If you only need some values from the header create your own object and return that instead of the headers.


Let us know how it goes and feel free to follow up with more questions.


Userlevel 7
Badge +8

@khakman just wanted to check in on this to see if the suggestion from @BowTieBots got you what you needed or if you're still running into trouble here. Let us know!