Skip to content

Conversation

keenwilson
Copy link
Contributor

Problem

The Toolkit login webview throws an error when calling setUiReady() because loadMetadata is undefined:

[error] webviewId="aws.toolkit.AmazonCommonAuth": Error: Webview error
-> Error: Webview backend command failed: "setUiReady()"
-> TypeError: Cannot read properties of undefined (reading 'start')

This occurs because supportsLoadTelemetry defaults to false in the base VueWebview class, preventing the initialization of loadMetadata during webview setup. Without loadMetadata, the webview cannot track load timing or emit load telemetry.

Solution

Added one line to enable load telemetry in ToolkitLoginWebview.

This flag was originally introduced in e7b7307 to track Amazon Q webview load times and failures. We're now extending this functionality to the Toolkit login webview for consistent telemetry across both implementations.

Before fix:

before-toolkit-auth-webview-error

Toolkit login webview error showing loadMetadata undefined. This occurs because supportsLoadTelemetry defaults to false in the base VueWebview class, preventing the initialization of loadMetadata during webview setup. Without loadMetadata, the webview cannot track load timing or emit load telemetry. The error happens here when trying to calculate duration:

const duration = globals.clock.Date.now() - this.loadMetadata!.start

After fix:

Toolkit login webview successfully loading with duration metrics.

after-toolkit-auth-webview-with-load-duration
  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@keenwilson keenwilson requested a review from a team as a code owner September 26, 2025 21:12
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

Copy link

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

@keenwilson keenwilson changed the title fix(auth): Enable load telemetry for Toolkit login webview telemetry: Enable load telemetry for Toolkit login webview Sep 26, 2025
@keenwilson keenwilson changed the title telemetry: Enable load telemetry for Toolkit login webview telemetry(auth): Enable load telemetry for Toolkit login webview Sep 26, 2025
@laileni-aws
Copy link
Contributor

/retryBuilds

@laileni-aws laileni-aws enabled auto-merge (squash) September 30, 2025 16:51
@laileni-aws laileni-aws merged commit 9b0deb2 into aws:master Sep 30, 2025
30 of 31 checks passed
@keenwilson keenwilson deleted the fix-auth-telemetry branch September 30, 2025 18:28
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 this pull request may close these issues.

6 participants