question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The action is crashed after throwing the UnauthorizedError exception

See original GitHub issue

Abstract

The action is crashed after throwing the UnauthorizedError exception.

Expected behavior

After throwing an UnauthorizedError exception to revoke an access token by the code below, the following things are expected:

app.intent("signout", conv => {
  throw new UnauthorizedError("Signed out. Do you want to continue to use this action?");
});
  • The access token is revoked.
  • The Google Assistant responds the user with the SimpleResponse: “Signed out. Do you want to continue to use this action?” without crashing.

Actual behavior

After throwing an UnauthorizedError exception with the code above, the following things happen:

  • The access token is revoked.
  • The action is crashed without responding any message from the Google Assistant.

Detail

On the issue #187, a new feature to revoke an access token was requested. The reporter said that when we can prepare a middleware to respond HTTP Status code 401, but the way is not good because the action is crashed at the same time. Other people posted some comments which have the same meaning as well.

Then, the new exception UnauthorizedError has been provided by the version 2.6.0. By throwing the exception, our actions can respond HTTP Status code 401 at any time. At the same time, the access token can be revoked.

However, the action is crashed as well. This behavior was not expected in the original issue #187. Instead, I guess that they thought that the Google Assistant should respond a message (ex. with the SimpleResponse) without crashing.

I think that we can’t use the UnauthorizedError exception in our actions except the test purpose (ex. at developing before publishing). And, we can use the “Unlink” button on the Action Simulator to revoke an access token during developing, therefore, I can’t image the use case of the UnauthorizedError exception.

Suggestion

I would like to suggest the following:

  • Change the behavior of the UnauthorizedError exception. That is, when the exception is thrown, an access token is revoke and a SimpleResponse with the message specified by the argument of the exception is returned, instead of responding the 401 status code.
  • As other idea, provide a new helper class to order an access token revoking as like the following:
app.intent("signout", conv => {
  conv.ask([
    new RevokeToken(),
    new SimpleResponse("Signed out. Do you want to continue to use this action?")
  ]);
});

Anyway, I think that a new way to revoke an access token without crashing action is necessary. Of course, users can use the UI on each information page of the action to revoke an access token. But, if we have that new way, we will be able to integrate a feature to sign out in the conversation seamless.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Canaincommented, Feb 25, 2019

UPDATE: We are aware of this issue and will be rolling a fix for the action crashing.

1reaction
Canaincommented, Feb 22, 2019

Hi, thanks for reporting!

We have relayed this to the engineering team to investigate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
Throwing errors. Apollo Server throws errors automatically when applicable. For example, it throws a GRAPHQL_VALIDATION_FAILED error whenever an incoming ...
Read more >
Java: Program not crashing after throwing exception
If an exception message is being printed but the program does not crash, that implies that code somewhere up the call stack is...
Read more >
Error Handling Best Practices - Auth0
Error conditions returned from API calls must be handled and processed in an appropriate manner. Failure to do so can lead to unhandled...
Read more >
Addressing language exception crashes - Apple Developer
Address crashes from a system language exception. After identifying the operating system's API throwing the exception, consult the documentation for that API to ......
Read more >
Angular applications —error handling and elegant recovery
When we started to design our enterprise client, we asked our UX designer to give us some design tips on how to handle...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found