Open sentry-io[bot] opened 3 months ago
Sentry Issue: METAMASK-MOBILE-2E7E
Sentry Issue: METAMASK-MOBILE-2F6D
Sentry Issue: METAMASK-MOBILE-2ERR
Sentry Issue: METAMASK-MOBILE-2EPT
Sentry Issue: METAMASK-MOBILE-2FXF
Sentry Issue: METAMASK-MOBILE-2DVD
node_modules/ethjs-ens/node_modules/ethjs-rpc/lib/index.js
in self.currentProvider.sendAsync$argument_1
at line 53:35
self.currentProvider.sendAsync(parsedPayload, function (err, response) {
var responseObject = response || {};
if (err || responseObject.error) {
var payloadErrorMessage = '[ethjs-rpc] ' + (responseObject.error && 'rpc' || '') + ' error with payload ' + JSON.stringify(parsedPaylo {snip}
var payloadError = new Error(payloadErrorMessage);
payloadError.value = err || responseObject.error;
return cb(payloadError, null);
}
return cb(null, responseObject.result);
I tracked this down to Engine.ts and the code pointed at in @metamask/json-rpc-engine but I'm not sure how this ends into an exception not being caught and land in Sentry.
@Gudahtt has some notes to add here.
The stack trace suggests that the error is happening as a result of an ethjs-ens
call, but the usage of that package in this project is very limited. The only callsites I could find were within try..catch blocks that would not allow the error to reach Sentry. I tried auditing the package for errors thrown out of band as well, and was unable to find a single instance where that seemed possible.
Maybe it's not coming from ethjs-ens
, and the stack trace that Sentry is showing us is incorrect? There are issues with the source maps in the affected releases.
Perhaps we could put this issue aside until the sourcemaps are fixed, so that we can verify what the real unminified stack trace is.
Or alternatively, we could manually verify each stack frame using the production bundle, but @NicolasMassart and I discussed this approach already and we ran into issues here because the bundle uses byte code rather than JavaScript (I'm not sure how to decompile it while preserving line numbers, and even if we manage to, the resulting code bears very little resemblance to the source code)
Okay, moving to Blocked for now.
Sentry Issue: METAMASK-MOBILE-2G16
Sentry Issue: METAMASK-MOBILE-2G16
Sentry Issue: METAMASK-MOBILE-2G68
Sourcemap are now correct, we check them regularily and at least for the last ones if matches the source code. We still may have issues as it's not solved on CI side, but if we figure it out fast enough and remove the extra artifacts it works. If sourcemap is wrong, the error message is compeletely unrelated to the code pointed at and it's clearly not the case here:
Error:
[ethjs-rpc] rpc error with payload {"id":7030016583578,"jsonrpc":"2.0","params":[{"to":"**","data":"******************************************5604fb93aada9cfabd08f3c0c91e4d26"},"latest"],"method":"eth_call"} Ty...
Code for node_modules/ethjs-ens/node_modules/ethjs-rpc/lib/index.js
in self.currentProvider.sendAsync$argument_1
at line 53:35
self.currentProvider.sendAsync(parsedPayload, function (err, response) {
var responseObject = response || {};
if (err || responseObject.error) {
var payloadErrorMessage = '[ethjs-rpc] ' + (responseObject.error && 'rpc' || '') + ' error with payload ' + JSON.stringify(parsedPaylo {snip}
var payloadError = new Error(payloadErrorMessage);
payloadError.value = err || responseObject.error;
return cb(payloadError, null);
}
return cb(null, responseObject.result);
I looked into this, and there are two functions from ethjs-rpc
that are used in the mobile app. Here is where they are used:
async doENSReverseLookup
(app/util/ENSUtils.js
)
async validateAddressOrENS
(app/util/address/index.js
)async validateAddressOrENSFromInput
(app/components/Views/Settings/Contacts/ContactForm/index.js
)
onChangeAddress
(app/components/Views/Settings/Contacts/ContactForm/index.js
)validateAddressOrENSFromInput
is NOT awaitedasync validateAddressOrENSFromInput
(app/components/Views/confirmations/SendFlow/SendTo/index.js
)
onToSelectedAddressChange
validateAddressOrENSFromInput
is NOT awaitedasync validateAddressOrENSFromInput
(app/component/Views/confirmations/components/ApproveTransactionReview/AddNickname/index.tsx
)
useEffect
validateAddressOrENSFromInput
is NOT awaiteduseEffect
(app/components/UI/AccountFromToInfoCard/AccountFromToInfoCard.tsx
)doENSReverseLookup
is NOT awaitedasync doENSLookup
(app/components/UI/AccountOverview/index.js
)~async updateAccountInfo
(app/components/UI/DrawerView/index.js
)async componentDidUpdate
(app/components/UI/DrawerView/index.js
)async useEnsNameByAddress
(app/components/hooks/useEnsNameByAddress/index.ts)
~async lookupEns
(app/components/Views/EditAccountName/EditAccountName.tsx
)~useEffect
(app/components/Views/confirmations/SendFlow/AddressFrom/AddressFrom.tsx
)doENSReverseLookup
is effectively NOT awaitedasync onSelectAccount
(app/components/Views/confirmations/SendFlow/AddressFrom/AddressFrom.tsx
)async fetchENSName
(app/components/Views/confirmations/SendFlow/AddressElement/AddressElement.tsx
)useEffect
(app/components/Views/confirmations/SendFlow/AddressElement/AddressElement.tsx
)
doENSReverseLookup
is NOT awaitedasync doENSLookup
(app/utils/ENSUtils.js
)
async validateAddressOrENS
(app/utils/address/index.js
)Note that there are a few cases where doENSReverseLookup
or doENSLookup
is not properly awaited, and so the error may be thrown out of band.
So I have a couple of questions:
Sentry Issue: METAMASK-MOBILE-2GHZ
Sentry Issue: METAMASK-MOBILE-2GW2
There were some recent type changes in @metamask/json-rpc-engine
that may have affected error handling behavior, although the intention was to avoid introducing runtime breaking changes.
Looking at the _promiseHandle
method linked above that method calls #handle
, whose callback
parameter's error
parameter was changed from optional to required in this line. Maybe this or another change made in this release is related to this bug? The callback
parameter in this link would be directly downstream of cb
in the sendAsync
method mentioned above.
Another similar change was made here in the handle
method while fixing an any
type.
Sentry Issue: METAMASK-MOBILE-2E6V