Comments (11)
Why not to use :
Airbrake.getProject()[0] # to get project_id
Airbrake.getProject()[1] # to get project_key
?
from airbrake-js.
Hi @Ditchou Thanks for reporting.
@vmihailenco and @duncanbeevers Can you give some insight here please.
from airbrake-js.
The project id and project key are supposed to be pulled from the data attributes on the script
tag, which it looks like you've set up correctly. The immediately-executed function you posted bootstraps the notifier, extracting these values from the data attributes and configuring the client with them.
I'd like to see why the bootstrap isn't pulling in those values for you. Could you throw a debugger into the bootstrapping snippet and see whether it finds the script tag in question and extracts values for project_id
and project_key
?
Alternatively, after the script has bootstrapped, you can manually set the project_id
and project_key
using
client.setProject("92691", "4a662a0c82ca9210994173a1048d7023")
from airbrake-js.
Hello,
Yes, it found the values and extract them doing this :
client.setProject(project_id, project_key);
But the issue is that it's executed after :
JsonpReporter()
And JsonpReporter.report() use project_id passed in attribute to the JsonpReporter function.
from airbrake-js.
A new JsonpReporter
instance is created for each error, initialized with the project_id
and project_key
as provided by client.getProject
in the getReporter
function.
Is there some other site where client.setProject
is getting called with undefined values?
from airbrake-js.
No, client.setProject is called once with great parameters. You can not reproduce the issue? Just create an empty rails project.
from airbrake-js.
I just spun up a trivial Rails app with your haml snippet, inserted a breakpoint in the report
function and fired off a test error. I see the appropriate project_id
and project_key
referenced.
from airbrake-js.
Really? I tried with just this layout :
!!! 5
%html(lang="en"){"ng-app"=>"Pesto"}
%head
:javascript
window.Airbrake = [];
window.Airbrake.try = function(fn) { try { fn() } catch(er) { window.Airbrake.push(er); } };
%script{ "defer" => "", "src" => "https://ssljscdn.airbrake.io/airbrake-js-tracekit-sourcemap.js", "data-airbrake-project-id" => "92691", "data-airbrake-project-key" => "4a662a0c82ca9210994173a1048d7023", "data-airbrake-project-environment-name" => "#{Rails.env}" }
%meta(charset="utf-8")
%meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
%meta(name="viewport" content="width=device-width, initial-scale=1.0")
%title= content_for?(:title) ? yield(:title) : "Pesto"
%body
:javascript
Airbrake.try(function() {
document.headdd.test
});
And it does not work... Do you use the same version of airbrake-js-tracekit-sourcemap.js ? (For information, i am working in local (not on a server))
from airbrake-js.
I was able to reproduce this issue thanks to your report. This occurs when the shim has errors pushed to it before the client is in place. Those errors are reported before the client completes its bootstrap.
I've put a fix in place and opened a pull request against the main repository. We should be able to get new versions pushed out quickly.
In the meantime, you should be able to avoid this problem by simply removing the defer
attribute from the airbrake script tag and loading the notifier synchronously until the new versions are made available.
from airbrake-js.
I tried it again today and it still does not work. @benarent , can we deploy new version?
from airbrake-js.
I can't reproduce this any more. Closing.
from airbrake-js.
Related Issues (20)
- Reduce package size HOT 6
- Params not passed on notify method with React ErrorBoundary HOT 1
- This dependency was not found: * async_hooks in ./node_modules/@airbrake/node/esm/scope.js
- Object Not Found Matching Id:3
- Github security alerts
- Cross-Fetch dep is trying to use XHR in service-worker context. HOT 2
- [Documentation] Version 1 to Version 2 Migration Guide
- Unable to post sourcemaps to /v4/projects/:projectId/sourcemaps HOT 2
- Too aggressive error grouping
- No backtrace on error HOT 3
- Uncaught ReferenceError: Notifier is not defined airbrake angularjs HOT 1
- security update: cross-fetch HOT 7
- Airbrake not globally available when using webpacker
- Using blocklist with "name" filters out notifier name HOT 2
- error-stack-parser versions < 2.1.4 causes stack parsing to fail with `ErrorStackParser.parse is not a function` error HOT 2
- Simplify "notify" for error reporting
- Test suite shouldn't make network calls
- AbortError: The user aborted a request.
- Use of instrumentation.fetch for Performance Statistics HOT 1
- Rejected error with Cybersource Flex Microform JS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airbrake-js.