Open sentry-io[bot] opened 1 year ago
Events in past 14 days: 327
A 403 status typically indicates a "Forbidden" response, suggesting that MetaMask does not have permission to access a particular resource or endpoint. The subsequent message, "Failed to fetch Swaps feature flags and Swaps liveness, defaulting to false.", indicates that because the fetch failed, the feature flags for "Swaps" were set to false by default.
This error seems to be tracking not just 403 failures, but any failed requests in fetch--with-cache
that don't meet the if (!response.ok) {
condition
It seems there are cases where fetchWithCache is called from ui/components/ui/new-network-info/new-network-info.js
and it can fail with a 403
There are other cases where fetchWithCache is called from ui/pages/swaps/swaps.util.ts
and it can fail with a 422
Another is ui/pages/swaps/swaps.util.ts in a.fetchTopAssets
Another is ui/pages/swaps/swaps.util.ts in a.fetchAggregatorMetadata
As a solution to this problem, we could look at each place that fetchWithCache
is called, and add specific handling for 403, 422 and 429 errors.
After having a chat with @gauthierpetetin we would like to solve this issue in following way: 1- trace the issue to see if there’s a way to fix for each error code eg: 502 is caused by language missing in some locales Private Zenhub Image
2- improve the error message to log better:
eg: Fetch with cache failed within function 'getIsTokenDetectionSupported' with status '502':
There is a similar Sentry issue for calls to RPC provider, while this Sentry issue happens for specific API requests.
In the case of calls to RPC providers:
In the case of specific API requests:
This PR from @DDDDDanica will disaggregate the Sentry issue into multiple ones, which will allow us to have access to a list of different events for each specific API.
Next steps:
Tickets created: Swaps: https://github.com/MetaMask/metamask-extension/issues/20838 new-network-info: https://github.com/MetaMask/metamask-extension/issues/20853
With @DDDDDanica 's PR now being merged and released in prod, we have a list new Sentry issues (one for each specific API). We will link all these new Sentry issues to this Github issue.
Sentry issue: METAMASK-X7EP
Sentry issue: METAMASK-X7EN
Sentry issue: METAMASK-X7EM
Hi @cloudonshore , do you have an idea what can lead to these 403 errors? Here's the specific Sentry issue we're investigating. Here's the API endpoint being called: https://token-api.metaswap.codefi.network/tokens/0xe708
Sentry issue: METAMASK-X7JJ
Sentry issue: METAMASK-X89G
This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 45 days if there is no further activity. The MetaMask team intends on reviewing this issue before close, and removing the stale label if it is still a bug. We welcome new comments on this issue. We do not intend on closing issues if they report bugs that are still reproducible. Thank you for your contributions.
@DDDDDanica 's PR has allowed to offer better visibility on what API calls are failing causing these issues.
Comment from API Platform team:
403 errors are expected in small numbers. If they occur in large numbers, it may be due to an improper security mechanism we added server side. So if we see a spike in 403s, we should throw an alert so we catch the error state.
Next step:
Sentry Issue: METAMASK-PVS3
403 errors are expected in small numbers. If they occur in large numbers, it may be due to an improper security mechanism we added server side. So if we see a spike in 403s, we should throw an alert so we catch the error state.
Next step: