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

Trace errors in production for JavaScript executions sent by the server-side #188

Open
mcollovati opened this issue Mar 20, 2023 · 0 comments

Comments

@mcollovati
Copy link
Contributor

mcollovati commented Mar 20, 2023

JavaScript's errors raised when executing code sent from the server-side (e.g. Page.executeJs()) cannot be traced in production because Flow client silently suppresses them.

vaadin/flow#2028
vaadin/flow#2963

To be able to trace errors from the server-sent JavaScript code in production mode, we may need to tweak the Flow client Console.reportStacktrace() method.

public static void reportStacktrace(Exception exception) {
    if (GWT.isScript()) {
        if (shouldLogToBrowserConsole) {
            doReportStacktrace(exception);
        }
    } else {
        exception.printStackTrace();
    }
}

where shouldLogToBrowserConsole = !ApplicationConfiguration.isProductionMode

It seems to me that instrumenting the GWT generated JavaScript code is not possible, or at least not easy to accomplish.

Something we can maybe do is to add a traceErrors flag in Flow client ApplicationConfiguration, propagate it to Console and change the above method to consider also this configuration.
Then, if we do not want the developers to be able to set the configuration on their own, we can try to add an instrumentation in Observability Kit that intercepts BootstrapHandler$ApplicationParameterBuilder.getApplicationParameters and adds the flag to the returned JsonObject.

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

No branches or pull requests

1 participant