getsentry / sentry-javascript Goto Github PK
View Code? Open in Web Editor NEWOfficial Sentry SDKs for JavaScript
Home Page: https://sentry.io
License: MIT License
Official Sentry SDKs for JavaScript
Home Page: https://sentry.io
License: MIT License
Hello,
I use bower (package manager, cf https://github.com/twitter/bower) and it uses tags to know what is the last version.
For the moment, I've got 0.5.2.
Can you make tags of the 0.6.0 for instance?
It doesn't get past the interface validator in Sentry.
Might be a fix I can make in the server to discard invalid frames, but we should probably do something in raven-js as well (probably just call captureMessage instead, or throw an error).
I've been (officially) taking over maintainership of a bunch of the primary repos on the getsentry org. Wondering if you guys still have time to maintain this, or if you'd be interested in moving that over as well.
https://www.getsentry.com/docs/javascript/ talks about version 0.6 and having dependency upon jQuery.
Sorry this is probably the wrong place to add this issue, but I couldn't find where the javascript doc was in the sentry project :(
This is a remnant of pre 1.0 days with the "Script error."
issue, but this has since been hardcoded into raven. It doesn't really help with anythign else.
TraceKit is the new hotness. Let's just hop on board and use it instead of our collection code.
So, before a request is going to get fired off to sentry, handing that event to a callback so that I could return a set of tags or options to be appended to the requrest.
An example use (for me in paricular) is adding tags that specify requireJS: true/false to events that get caught by require's onError such as script loading or other stuff hapenning in a require load.
This is useful if the same event gets fired in both place for filtering.
Is there a way to get Raven to log all thrown errors? For some reason, it logs some throw
calls but not others. I found that it tends to not log behavior that is nested further down the call stack.
Realistically we don't want to encourage everyone to install from the CDN, and even more importantly we need to point them at an actual release they can download (e.g. that includes the compressed/uncompressed/sourcemap).
Probably worthwhile to document bower or whatever is supported as well.
e.g. level, logger, etc
Raven.captureMessage({
message: 'Foo bar',
level: 'warning',
logger: 'override.my.logger',
})
We should adjust the servers setting to accept base URLs that way we can properly construct the remainder using project-id
We need to implement some behavior in Sentry (so this ticket applies to both raven-js and Sentry) that removes the need for Raven to send a signed request. The signed request in JS doesn't actually provide any benefit, as it exposes the signing key (secret key).
Two things we should do:
Start by a default filter for raven\.(min\.)js$
to filter out our own builds.
This will overall be better than checking function name since that's usually horrible inaccurate, especially with minification/obfuscation.
As discussed on the IRC channel, the usage instructions for Bower aren't exactly right since you'll end up running a version of the script that hasn't yet been compiled with the template files (which contain the closure and module definition).
In order to use JS package managers like Bower or Volo with raven-js, the built version needs to be available on GitHub (either in this repo or another).
There's this code in Raven:
// TraceKit.report will re-raise any exception passed to it,
// which means you have to wrap it in try/catch. Instead, we
// can wrap it here and only re-raise if TraceKit.report
// raises an exception different from the one we asked to
// report on.
try {
TK.report(ex, options);
} catch(ex1) {
if(ex !== ex1) {
throw ex1;
}
}
which seems to go against the point of reraising the exception in TraceKit:
/*
* Tries to catch all unhandled exceptions and report them to the
* subscribed handlers. Please note that TraceKit.report will rethrow the
* exception. This is REQUIRED in order to get a useful stack trace in IE.
* If the exception does not reach the top of the browser, you will only
* get a stack trace from the point where TraceKit.report was called.
*/
By ignoring the exception here, TraceKit doesn't get the opportunity to create a stack trace for some versions of IE, which means you'll only get the top stack frame, if you're lucky.
Is there any reason the exception is caught here? If you want to ignore the exception, you can install a default window.onerror handler that returns true, or patch TraceKit so that exceptions are only reraised (and then ignored) if the stack trace is incomplete.
Please update the bower version :)
I tried the current master (1.0-beta11) to be able to use setUser(). However, events can not be logged anymore because the request line is too long (my sentry installation is deployed behind Apache, which limits requestline lengh to 4096).
The makerequest
function has been changed from a POST to a GET:
function makeRequest(data) {
new Image().src = globalServer + getAuthQueryString() + '&sentry_data=' + encodeURIComponent(JSON.stringify(data));
}
With GET requests the data will always be limited (IE8 and IE9 limit it up to 2083 chars), and I think POST should always be used (or at least be an option).
Title should be succinct enough. ๐
// Set the user data
Raven.setUser({
email: '[email protected]'
});
// Clear the user data
Raven.setUser();
This would fill in sentry.interfaces.User
jQuery is used for 3 things:
Hi!
I've just pump to v1.0.0 and notice it's no longer tracekit inside your repo, because bower don't follow cloning the submodule.
For now installing tracekit as component bower install tracekit
gets the job done, but maybe creating a folder build/
with the minified version with the tracekit could be a way to go. I'll prefer not to download by hand your handy version in the CDN, and keep bower handle my project dependencies.
Probably it's more an bower issue, than yours, but's just to let you know.
fast track to this issue:
cd /tmp && mkdir tracekit-bug && cd tracekit-bug #just to use a clean folder
bower install raven-js
ls components/raven-js/vendor/TraceKit/ #nothing here :(
impressive project BTW!
Cheers,
iknite
We're seeing this occasionally in our error logs: Uncaught TypeError: Cannot call method 'slice' of undefined
. This appears to be the offending line:
args=fn[1].slice(0,-1).split(',');
The UA is 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11'
With the latest update, I am no longer able to use raven-js. All errors result to:
OPTIONS https://app.getsentry.com/api/3302/store/ 200 (OK) jquery.min.js:4
POST https://app.getsentry.com/api/3302/store/ 403 (FORBIDDEN)
Hi there,
I tried to use Raven-js in order to perform cross-domain logging, with JQuery.
Everything works in Chrome, but it fails in IE9.
The error returned by the ajax call was at first
No Transport
After reviewing this thread, I forced the CORS of jQuery :
$.support.cors = true;
The error message changes to
Access Forbidden
I guess this is because "custom headers arent supported in IE9" as said in the code.
Before trying to switch to Raven, I managed to achieve similar cross-domain reporting on IE9 by switching to JSONP when IE9 and Cross-domain are detected.
I would be happy to push that trick to this repository, but I am not sure yet that this is the issue.
What do you think ?
Cheers,
Antoine
To list a few:
I am using the hosted version of sentry and would love to use this for client side errors.
I've been trying to add custom error handling to sometimes reload a page when a particular type of error occurs, but I'd also like to report that through raven to sentry.
My current way of accomplishing this is by exposing the private TraceKit used by Raven through a Raven.TK variable.
This is sort of sub optimal, though, since TraceKit does all sorts of weird stuff if you're on IE, etc, and I'm not always guaranteed that my tracekit handler will be called before Raven's TK handler.
It also requires me to know that Raven uses TK and how TK works.
In reality, all I need to know is that Raven has caught an error, and successfully reported it Sentry, and also ideally the error it reported.
Then I could let Raven handle errors, report them, and when it's done, look at the error and try reloading.
Thanks.
I see you have added feature with "Script Error" for some javascript error reports ( #14 ). We have a lot of this bugs on our servers. Is possible to see real error description?
I can found this config-option.
e.g.
captureMessage('foo', {
extra: {
key: 'value'
},
tags: {
key: 'value'
}
})
Implement at some point in the future. I don't want to break everything just yet. :)
On this line:
https://github.com/getsentry/raven-js/blob/master/src/raven.js#L409
I suppose you want to try/catch this.
Safari Version 6.0.2
Currently our application relies on hashes, I don't know on which page the error is happened.
Probably you might want to send the full url location.href
too.
Explicitly monkey patch console.* as log levels.
If you change jQuery defaults you can break the ajax request.
e.g. change defaults to jsonp type (instead of json) and it will no longer work
Raven.captureException(new Error('error'), {extra: {test: 'value'}});
I haven't been able to send tags with captureException
, but it is possible with captureMessage
. Example:
Raven.captureException(exc, {tags: {'host': host}}); // Doesn't send "host" tag to sentry
Raven.captureMessage(exc, {tags: {'host': host}}); // Sends "host" tag to sentry
See : http://sentry.readthedocs.org/en/latest/developer/interfaces/index.html#sentry.interfaces.Http
The Http interface allows retrieval of the current cookies.
This can be done by checking for define.amd
.
https://github.com/jrburke/requirejs/blob/master/require.js#L1921
Possibly require()
as well:
https://github.com/jrburke/requirejs/blob/master/require.js#L1325
Information:
20:57 < joar> so, since raven-js is incompatible with sentry 5.0.0-dev, is 4.9.8 the way to go? 20:58 < joar> 4.9.8 is also incompatible with raven-js 5.3 21:00 < joar> oh, perhaps I should use raven-js 5.2 instead. 21:03 < joar> nope, CORS pre-flight request still fails. 21:05 -!- dz0ny [[email protected]] has quit [Ping timeout: 276 seconds] 21:08 < joar> all right, using jQuery instead of zepto solves the CORS pre-flight request issue. 21:09 < joar> no wait, it doesn't. 21:09 < joar> but it at least tries to POST even though. 21:10 < joar> .. but when it posts, I receive an HTTP 400 reply, and the same issue as with sentry 5-dev and raven-js 5.3 comes into effect: https://gist.github.com/4603075e14a15fb1db77 21:20 < joar> same issue with raven-js 5.2 against app.getsentry.com. 21:22 < joar> oh wait, forgot to reload my config. 21:26 < joar> app.getsentry replies with an HTTP 400 and "Invalid data: Unable to validate interface, 'sentry.interfaces.Stacktrace':"-- https://gist.github.com/258a66f77781c143792b
My ignoreErrors is currently this:
ignoreErrors: [null,
'',
'Operation aborted',.....]
However, I'm still receiving "Operation aborted" errors in sentry.
Here is a sample event:
https://app.getsentry.com/sideqik/sideqik/group/3671684/
We should change the AJAX call to create an iframe + form and POST to the endpoint, this will allow it to work on non-same-domain installs.
When using raven-js on a site running on a non port 80/443 server, doing this fails:
// capture an exception
try {
errorThrowingCode();
} catch(err) {
Raven.captureException(err);
}
i.e. running locally for testing on http://localhost:8000 (with that set as allowed origin for CORRS), you'll get raven exceptions as it strips the from the ":" on wards.
To prevent bloat in the core lib, come up with a strategy for plugins. These plugins would be small, but would easily hook in and wrap the offerings.
For example, a requirejs plugin would wrap the define/require blocks and anythign else it can fine.
jQuery would wrap it's common callbacks, etc.
This will allow us to be as flexible as possible by keeping an archive of plugins and let users pick and choose what they want.
Hi,
I'm trying to use sentry with raven-js on a phoneGap project.
I've a little problem...it's about URL security.
In sentry for raven-js i need to define some URL to protect my server.
But, in phoneGap i've no URL on my app. So, sentry doesn't listen to my app.
How can i solve it?
Any modification is possible to allow all URL for a define project?
Thank's!
We did this at DISQUS because we were getting it way too often and the message itself was not useful.
Could be an option thats just enabled by default as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.