Skip to main content
Question

"Response needs to be JSON, form-urlencoded or parsed in middleware."

  • 8 February 2023
  • 2 replies
  • 696 views

Hello,

i’m currently working on creating a zapier app with the help of the zapier-cli.
During the last step of authentication (“getAccessToken”), i successfully receive the ‘access_token’ in the response, but zapier throws an error, saying: "Response needs to be JSON, form-urlencoded or parsed in middleware.".

The response from our backend looks like this: {"access_token":"CodeGoesHere"} and sends the Content-Type header `application/json`.

What could be the reason for this error and/or how can i further debug/fix this?

 

Regards,

Daniel

2 replies

Userlevel 1

I have also faced the same issue, when creating a zapier app. Has anyone found a solution to this problem?

Userlevel 7
Badge +5

Hi @deprecated and @EGharoon,

 

You guys seem to have the correct format for your response, and you're sending it with the appropriate 'Content-Type' header. However, Zapier still does not recognizing it properly.

 

Here are a few things you could try:

  1. Double-check the response headers: Ensure your server correctly sets the 'Content-Type' header to 'application/json.' Sometimes, server configurations may overwrite this value, or it may not be correctly set in the first place.
  2. Verify the response body: Ensure that your response body is a correctly formatted JSON. You can use online JSON validators to confirm this.
  3. Check middleware settings: If you're using any middleware in your application, ensure it does not modify the response or headers before they are sent to Zapier.
  4. Zapier CLI version: Ensure you're using the latest version of Zapier-platform-cli. If not, consider updating it.
  5. Use Zapier CLI logs: Use the Zapier CLI's logging capabilities to get more detailed information about what's happening during the authentication process. You can use the command Zapier logs to access them.

If none of these solutions work, you might want to contact Zapier's support. So we can help you debug the issue and find a solution. 

Reply