Best answer

How to handle Zapier authentiation failure propertly?

  • 13 February 2020
  • 4 replies
  • 1592 views

Userlevel 1

Screen Shot 2020-02-13 at 14.55.50.pngI'm trying to display a friendly message on the authentication failure prompt in Zapier. Throwing an Error or HaltedError is always showing the stack trace and the console logs which I'd like to get rid of. Is there a way to only display a custom message we specify?


icon

Best answer by Danvers 14 February 2020, 08:42

View original

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

4 replies

Userlevel 4
Badge +4

Make sure you test the message on an account that does not have Developer access to the app. Zapier checks the logged in user's credentials and provides additional information if your account has developer access.


What code are you currently trying to use to display the "friendly message"?


Userlevel 7
Badge +12

You can always catch the error in a try-catch block and remove the stack trace then throw it again. For example:

try {

// your code

} catch (error) {

error.stack = "\n"; // This should remove any stack trace from the error that is shown in the UI

throw error;

}



Userlevel 1

I'm using afterResponse where I'm validating the response status and throwing a HaltedError


if (response.status === 403) {

throw new z.errors.HaltedError('Help message here...');

}


This app is not promoted yet. I have shared access to this app by invitation and the account invited gets to see the same "What happened.. " and "Console logs: " messages. Can I remove developer access to an account invited?




Userlevel 7
Badge +12

You might find it easier to create a new Zapier account to test with and ask the owner of the app to invite that account. That way you don't have to keep adding then removing your regular account as a developer on the app.