How to use the raven.setContext function in raven

To help you get started, we’ve selected a few raven examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lifechurch / melos / nodejs / feature-server.js View on Github external
router.post('/featureImport/*', urlencodedParser, (req, res) => {
	const { feature, params, auth } = req.body
	const assetPrefix = getAssetPrefix(req)
	// const Locale = getLocale(params.languageTag)

	Raven.setContext({ user: auth, tags: { feature, url: params.url }, extra: { params } })

	reactCookie.plugToRequest(req, res)

	let verifiedAuth = null
	checkAuth(auth).then((authResult) => {
		const sessionData = Object.assign({}, authResult.userData)
		authResult.userData.password = null
		verifiedAuth = authResult
		const defaultState = getDefaultState(feature)
		let startingState = Object.assign({}, defaultState, { auth: verifiedAuth })
		startingState = mapStateToParams(feature, startingState, params)

		const Locale = getLocale({
			localeFromUrl: params.languageTag,
			localeFromCookie: params.cookiesLocale,
			localeFromUser: authResult && authResult.userData && authResult.userData.language_tag ? authResult.userData.language_tag : null,
github comicrelief / lambda-wrapper / src / Service / Logger.service.js View on Github external
constructor(di: DependencyInjection) {
    super(di);
    this.raven = null;
    const container = this.getContainer();
    const event = container.getEvent();
    const context = container.getContext();
    const isOffline = !Object.prototype.hasOwnProperty.call(context, 'invokedFunctionArn') || context.invokedFunctionArn.indexOf('offline') !== -1;

    // Set raven client context
    if (ravenIsAvailable && isOffline === false) {
      Raven.setContext({
        extra: {
          Event: event,
          Context: context,
        },
        environment: process.env.STAGE,
        tags: {
          lambda: context.functionName,
          memory_size: context.memoryLimitInMB,
          log_group: context.log_group_name,
          log_stream: context.log_stream_name,
          stage: process.env.STAGE,
          path: event.path,
          httpMethod: event.httpMethod,
        },
      });
github balena-io / balena-cli / lib / app-common.ts View on Github external
function setupRaven() {
	const Raven = require('raven');
	Raven.disableConsoleAlerts();
	Raven.config(require('./config').sentryDsn, {
		captureUnhandledRejections: true,
		autoBreadcrumbs: true,
		release: require('../package.json').version,
	}).install(function(_logged: any, error: Error) {
		console.error(error);
		return process.exit(1);
	});

	Raven.setContext({
		extra: {
			args: process.argv,
			node_version: process.version,
		},
	});
}
github Syncano / syncano-node / packages / cli / src / utils / error-response.js View on Github external
captureException (err) {
    const context = this.context
    const session = context.session

    if (session) {
      const account = session.settings.account
      delete account.attributes.auth_key
      Raven.setContext({ user: { session, account } })
    } else {
      Raven.setContext({ user: { context } })
    }

    Raven.captureException(err)
  }
github lifechurch / melos / feature-server.js View on Github external
router.post('/featureImport/*', urlencodedParser, (req, res) => {
	const { feature, params, auth } = req.body
	const assetPrefix = getAssetPrefix(req)
	const Locale = getLocale(params.languageTag)

	nr.setTransactionName(`featureImport/${feature}`)

	Raven.setContext({ user: auth, tags: { feature, url: params.url }, extra: { params } })

	reactCookie.plugToRequest(req, res)

	let verifiedAuth = null
	checkAuth(auth).then(nr.createTracer('checkingAuth', (authResult) => {
		const sessionData = Object.assign({}, authResult.userData)
		authResult.userData.password = null
		verifiedAuth = authResult
		const defaultState = getDefaultState(feature)
		let startingState = Object.assign({}, defaultState, { auth: verifiedAuth })
		startingState = mapStateToParams(feature, startingState, params)

		try {
			const history = createMemoryHistory()
			const store = getStore(feature, startingState, history, null)
			loadData(feature, params, startingState, sessionData, store, Locale).then(nr.createTracer('loadData', (action) => {