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

[phrasePlugin][Stale Private Key]: #3755

Merged

Conversation

anaghav2023
Copy link
Contributor

@anaghav2023 anaghav2023 commented Nov 25, 2024

Description

The Private key in phrase plugin gets updated only in constructor i.e. when the plugin loads. This happens on initial set-up or when we refresh builder web-app. This stale private key causes authorization failure when we switch b/w environments.
The solution is a small fix which gets the latest private key everytime before making api-call.

Loom showing before after

https://www.loom.com/share/63c07935720749b7800aaf422b771ae4

@anaghav2023 anaghav2023 requested a review from a team as a code owner November 25, 2024 07:16
@anaghav2023 anaghav2023 requested review from teleaziz and removed request for a team November 25, 2024 07:16
Copy link

changeset-bot bot commented Nov 25, 2024

⚠️ No Changeset found

Latest commit: f823f3c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@midhunadarvin midhunadarvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@sanyamkamat sanyamkamat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do add connected Jira ticket in the PR title and description

@@ -34,11 +34,12 @@ export class Phrase {
}

async request(path: string, config?: RequestInit, search = {}) {
let privateKey = await appState.globalState.getPluginPrivateKey(pkg.name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be expensive, since it would hit firestore everytime instead of once per load. I think that's the reason why it is cached.

Could we look at how many times this URL is called daily to understand impact?

@anaghav2023
Copy link
Contributor Author

Do add connected Jira ticket in the PR title and description

@sanyamkamat since Jira is our internal project and this is open source, I thought we were not adding jira ids here

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.

5 participants