-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hello:
I have been trying to test the Javascript error reporting (automatic or manually caught) using the async method suggested in the documentation, and although it works like charm in Firefox 57.0.1, I had to do a major tweak and disable the sync load to make it work in Chrome 62.0.3202.94.
Instead of the suggested method for loading the library, I had to do the following:
<script src="//cdn.jsdelivr.net/gh/AppEnlight/appenlight-client-js@0.5.1/appenlight-client.min.js"></script>
<script type="text/javascript">
var initAppEnlight = function () {
if(this.readyState!=='loading'){
AppEnlight.init({
apiKey: '{{ APPENLIGHT_KEY }}',
windowOnError: 1 // enable to hook to window.onerror
});
// setting request info is completly optional
AppEnlight.setRequestInfo({
server: '{{ SERVER_HOSTNAME }}',
username:'{{ request.user.username }}',
{% if request.META.HTTP_X_FORWARDED_FOR %}
ip: '{{ request.META.HTTP_X_FORWARDED_FOR }}',
{% else %}
ip: '{{ request.META.REMOTE_ADDR }}',
{% endif %}
// request_id:"server_generated_uuid"
});
}
};
initAppEnlight();
</script>
Previous to that each time I called the AppEnlight GrabError() or Log() functions I got 'AppEnlight is not defined" error on Chrome's debug console.
I'm not a JS developer so I'm not sure if the tweak I did is the right thing to do, or if there is a better way to overcome my issue with Chrome.
Thanks, and please keep going with the good work!
Erasmo
Metadata
Metadata
Assignees
Labels
No labels