logo
Tags down

shadow

How to automatically create a Sentry release and upload source-maps to Sentry in a react project?


By : user2174414
Date : October 18 2020, 08:10 AM
like below fixes the issue This script will create a Sentry release for version specified in the package.json file, and upload the source maps to Sentry.
It will work for any JS project, not just React.
code :
SENTRY_TOKEN="YOUR_TOKEN"
PACKAGE_VERSION=`cat package.json \
  | grep version \
  | head -1 \
  | awk -F: '{ print $2 }' \
  | sed 's/[",]//g' \
  | tr -d '[[:space:]]'`

printf "\nBuilding version $PACKAGE_VERSION...\n\n"

#2) Build for dev and cd to build directory
npm run build # or whatever your build command is
cd build/static/js # or whatever your build folder is

#3) create Sentry release
SOURCE_MAP=`find . -maxdepth 1 -mindepth 1 -name '*.map' | awk '{ gsub("./", "") ; print $0 }'`
printf "\nCreating a Sentry release for version $PACKAGE_VERSION...\n"

curl https://sentry.io/api/0/projects/:sentry_organization_slug/:sentry_project_slug/releases/ \
  -X POST \
  -H "Authorization: Bearer ${SENTRY_TOKEN}" \
  -H 'Content-Type: application/json' \
  -d "{\"version\": \"${PACKAGE_VERSION}\"}" \

#4) Upload a file for the given release
printf "\n\nUploading sourcemap file to Sentry: ${SOURCE_MAP}...\n"
curl "https://sentry.io/api/0/projects/:sentry_organization_slug/:sentry_project_slug/releases/$PACKAGE_VERSION/files/" \
  -X POST \
  -H "Authorization: Bearer ${SENTRY_TOKEN}" \
  -F file=@${SOURCE_MAP} \
  -F name="https://THE_URL_OF_THE_MAIN_JS_FILE/$SOURCE_MAP"

#5) IMPORTANT: Delete the sourcemaps before deploying
rm $SOURCE_MAP

#6) upload to your cloud provider
...


Share : facebook icon twitter icon

raven - sentry + django = No servers configured, and sentry not installed. Cannot send message


By : wallsbreaker
Date : March 29 2020, 07:55 AM
around this issue Were you really setting SENTRY_DNS or SENTRY_DSN?
When you set SENTRY_DSN the instantiation of the major config variables happens automatically (including SENTRY_SERVERS, SENTRY_PUBLIC_KEY, SENTRY_SECRET_KEY, and SENTRY_PROJECT)

Sentry - JavaScript Projects and Source Maps


By : user3728855
Date : March 29 2020, 07:55 AM
I wish this helpful for you The Sentry server will process the sourcemaps remotely as part of its pipeline. It looks for them based on the standard headers or annotations when it fetches the source itself, and will then fetch them automatically. In case of the files being unavailable publicly, there is also an API to send the files to the Sentry server using "releases".

Circle ci 2. sentry-cli can't find find dist folder to upload source maps


By : jpag
Date : March 29 2020, 07:55 AM
With these it helps I'm unsure of how your project is setup - but usually the dist folder is in the .gitignore and not uploaded to GIT and as such isn't available in the CI.
If you build the app on the CI then the dist folder will become available. I've assumed your build command is npm run build but it could also be yarn build or any custom command you use to build your application.
code :
- run:
    name: Build react application
    command: npm run build

- run:
    name: Install sentry-cli
    command: curl -sL https://sentry.io/get-cli/ | bash

- run:
    name: Create new sentry release from latest tag
    command: sentry-cli releases -o my-org -p my-project new ${CIRCLE_TAG/v/}

- run:
    name: Upload Source Maps to sentry
    command: sentry-cli releases -o my-org -p my-project files ${CIRCLE_TAG/v/} upload-sourcemaps ./dist

Send warning messages to Sentry (react-native-sentry)


By : integratedfreak
Date : March 29 2020, 07:55 AM
Hope this helps I have include Sentry to track crashes of my mobile application. It is working properly, now I want to send warning messages to sentry to track them. Is there a way to do this from JavaScript side. .
code :
// set a custom message
Sentry.captureMessage("TEST message", {
  level: SentrySeverity.Warning
}); // Default SentrySeverity.Error

How to setup Sentry-cli source maps with react-native


By : Thanh Xuan
Date : March 29 2020, 07:55 AM
To fix this issue After MONTHS, we realised we had to write client code to knit in the Distribution and Release....
code :
const configureSentry = () => {
    Sentry.config(config.sentry.dsn).install();
    Sentry.setDist(DeviceInfo.getBuildNumber());
    Sentry.setRelease(`${DeviceInfo.getBundleId()}-${DeviceInfo.getVersion()}`);
};
Related Posts Related Posts :
  • Select with optgroup in ReactJS
  • Ant Design form set values form props
  • How to make a row responsive using bootstrap in a react-application?
  • How would I pass data from one page to another in react?
  • How to resolve ':react-native-vector-icons' error for a successful build?
  • React 16.6.3 Context API contextType not being set
  • react fetch data and render the error if any
  • Setting Relative Path in React Router
  • Jest: How to provide Redux mock store to only the child component?
  • How to solve selectOptions.some is not a function while using AsyncCreatableSelect?
  • Modify css react component with styled-component
  • how to use npm run build on your react app?
  • Returning const with fragment to
  • disable check on a row click in DetailsList
  • Best way to update component after this handleClick?
  • mobx-react: component no response to injected store
  • when to and when not to use "this" in JSX event handler function reference?
  • React: how to forward refs to multiple children?
  • webpack errors out when using -p flag
  • Looping Lists with onClick Doesn't Work React
  • React - Jest - Enzyme: How to mock ref properties
  • Mock-axios-adapter not mocking get request
  • Map function React
  • How to retrieve data from promise object in React JS
  • Eslint-plugin-react configuration docs
  • Reactjs Map Changes state of Props
  • Wordpress Gutenberg React – render variable with HTML
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org