Coder Social home page Coder Social logo

Comments (11)

sebfie avatar sebfie commented on August 11, 2024

Why not to use :

Airbrake.getProject()[0] # to get project_id
Airbrake.getProject()[1] # to get project_key

?

from airbrake-js.

benarent avatar benarent commented on August 11, 2024

Hi @Ditchou Thanks for reporting.

@vmihailenco and @duncanbeevers Can you give some insight here please.

from airbrake-js.

duncanbeevers avatar duncanbeevers commented on August 11, 2024

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.

sebfie avatar sebfie commented on August 11, 2024

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.

duncanbeevers avatar duncanbeevers commented on August 11, 2024

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.

sebfie avatar sebfie commented on August 11, 2024

No, client.setProject is called once with great parameters. You can not reproduce the issue? Just create an empty rails project.

from airbrake-js.

duncanbeevers avatar duncanbeevers commented on August 11, 2024

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.

sebfie avatar sebfie commented on August 11, 2024

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.

duncanbeevers avatar duncanbeevers commented on August 11, 2024

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.

vmihailenco avatar vmihailenco commented on August 11, 2024

I tried it again today and it still does not work. @benarent , can we deploy new version?

from airbrake-js.

vmihailenco avatar vmihailenco commented on August 11, 2024

I can't reproduce this any more. Closing.

from airbrake-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.