Question

API Key “authentication failed: Error parsing response” error

  • 20 March 2022
  • 1 reply
  • 51 views

I’m doing a VERY simple API key authentication where I’m looking to return some text in the response. Below is my nodeJs endpoint code

router.get('/', (req, res) => {
var authenticated = (integrationKeys.get(req.query.key) == req.query.client);
if(authenticated){
res.status(200).send("Successful authentication");
} else {
res.status(401).send("invalid API key or client");
}
});

 

Zapier is barfing on the ad hoc text

authentication failed: Error parsing response. We got: "Successful authentication"
What happened (You are seeing this because you are an admin):
Starting GET request to https://b5df-68-67-666-666.ngrok.io/api/integration
Received 200 code from https://b5df-68-67-666-666.ngrok.io/api/integration?key=abc&client=myAbc after 88ms
Received content "Successful authentication"
Error parsing response. We got: "Successful authentication"

Console logs:

Stack trace:
SyntaxError: Error parsing response. We got: "Successful authentication"
at Object.<anonymous> (/var/task/node_modules/zapier-platform-core/src/execute.js:27:31)
...
...

 

What is Zapier expecting to receive in the response to an API key authentication call? 

  • Should there be a different response code?
  • Should the format of the send() body be diff’t?
  • Should it not be sending anything other than a bool in the send()?
  • Something else?

 


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

1 reply

Zapier expecting array response. Please check your response type.