Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible, to have user friendlier error response. #707

Closed
JexPY opened this issue Jun 19, 2022 · 2 comments
Closed

Possible, to have user friendlier error response. #707

JexPY opened this issue Jun 19, 2022 · 2 comments

Comments

@JexPY
Copy link

JexPY commented Jun 19, 2022

Describe the feature you would like to see

In our project, we needed dynamic links and fcm, so the head dev created the project and gave me Editor permissions, in dashboard I can read this:

image

And while using SDK to get dynamic link statistics I was getting the error saying:

{
    "code": 0,
    "errors": [
        "Failed to get statistics for dynamic link"
    ]
}

Then I tried to get more details about the error and could do that using try, catch

} catch (FailedToGetStatisticsForDynamicLink $e) {
    echo $e->response()->getBody();
    exit;
}

Result of catch:

{
  "error": {
  "code": 403,
  "message": "The caller does not have permission",
  "status": "PERMISSION_DENIED"
  }
}

So, I guess I don't have permission to see analytics.

p.s
Ask head dev to give me permission to access analytics once I will granted to will update the issue ^^

Regards.

@jeromegamez
Copy link
Member

Thanks for creating a new issue for this feature request (following your comment on #429)

With the next release, the SDK will provide a more helpful error message for permission denied errors and more information when a certain error is not yet handled by the SDK (e4f4199)

403 Errors

Firebase reported missing permissions to access the statistics
for the requested Dynamic Link. Please make sure that the
Google Dynamic Links API is enabled for your project at

    https://console.cloud.google.com/apis/library/firebasedynamiclinks.googleapis.com

If the API is enabled, you or the Service Account you're using
might be missing the required permissions. You can check by
visiting

    https://console.cloud.google.com/iam-admin/serviceaccounts/

and making sure that the Service Account has one of the following roles

    - Firebase Admin
    - Firebase Dynamic Links Viewer
    - Firebase Dynamic Links Admin

Other errors

Failed to get statistics for dynamic link. Please inspect the
response for further details.

If the response type is not covered by the SDK, please create
a new issue in the SDK's GitHub repository and include the
HTTP Status code (`$response->getStatusCode()`) and the
message body (`$response->getBody()->getContents()`)

@jeromegamez
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants