问题
My app is built with expo and sentry dashboard shows me 2 errors :
Discarded invalid parameter 'type'
and
Source code was not found for app:///crna-entry.bundle? platform=ios&dev=true&minify=false&hot=false&assetPlugin=%2FUsers%2FUser%2FDesktop%2Fpath%2Fto%2Fnode_modules%2Fexp.
So when i receive errors, it's impossible to debug because i only have an uglyfied built js.
Is there any way to upload the source expo source code manually. Which file should i send to sentry?
Thanks
回答1:
First way
If you are using expo. You should use sentry-expo
package which you can find here: sentry-expo
Put this hook to your expo json (app.json) file
{
"expo": {
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": {
"organization": "<your organization name>",
"project": "<your project name>",
"authToken": "<your auth token here>"
}
}
]
}
}
organization
you can find on here https://sentry.io/settings/ which named "Organization Name"project
enter your project name, you can find here: https://sentry.io/organizations/ORGANIZATION_NAME/projects/authToken
create a authToken with this url https://sentry.io/api/
Then run expo publish
, it upload the source maps automatically.
Testing Locally
Make sure that you enabled expo development. add lines;
Sentry.enableInExpoDevelopment = true;
Sentry.config(publicDsn, options).install();
As a Result
On sentry, for only ios, you can able to see the source code where error occured.
BUT: unable to see the source code for ANDROID
https://github.com/getsentry/react-native-sentry/issues/372
Second way (manual upload)
Using the api https://docs.sentry.io/platforms/javascript/sourcemaps/
curl -X POST \
https://sentry.io/api/0/organizations/ORG_NAME/releases/VERSION/files/ \
-H 'Authorization: Bearer AUTH_TOKEN' \
-H 'content-type: multipart/form-data' \
-F file=@script.min.js.map \
-F 'name=~/scripts/script.min.js.map'
来源:https://stackoverflow.com/questions/51977239/how-to-manually-upload-my-source-code-to-sentry