Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raygun4js only initialises if apiKey is set when onLoadHandler is called #454

Open
Widdershin opened this issue Apr 26, 2022 · 3 comments
Open
Assignees

Comments

@Widdershin
Copy link
Contributor

Widdershin commented Apr 26, 2022

This makes it difficult to initialise raygun4js asynchronously, which is becoming more common.

Related: #453, #383, #259

@Codex-
Copy link
Contributor

Codex- commented Jul 22, 2022

We've come across this issue today and did some digging / reproduction on the issue.

Please see this minimum reproduction and readme here: https://github.com/Codex-/rg4js-init-issue

The issue is that in a lot of cases a key is configured for raygun after the library has initialised, to work around this a consumer can call rg4js('boot'); (typescript typings pr raised for the typings issue: DefinitelyTyped/DefinitelyTyped#61397 )

I have a few ideas how this could be resolved but wanted to bounce ideas with the raygun team before I make a PR. Simplest thing would be to flag is onLoadHandler has been executed, then if an API key is configured after this has been executed, simply execute onLoadHandler again (which is what people are effectively doing by manually calling boot).

Another would be a stepping retry as a floated promise.

Let me know your thoughts :)

@Deacon-McIntyre
Copy link
Contributor

Hey @Codex- , thanks for the reproduction and types PR!

@Widdershin is currently away for a bit, but I've spoken to @darcythomas and we can take a look if you want to make a PR. The simplest approach seems fine for now 👍

@Codex-
Copy link
Contributor

Codex- commented Jul 25, 2022

No problem at all, I've raised #474 now with a fix :)

Also, if you haven't seen it, I have also raised: DefinitelyTyped/DefinitelyTyped#61397

This is to add the missing typing for calling 'boot', as users were doing some spooky casting to get around the missing type 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants