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

Da rp bucket location #5168

Closed
wants to merge 2 commits into from
Closed

Da rp bucket location #5168

wants to merge 2 commits into from

Conversation

davidangb
Copy link
Contributor

DO NOT MERGE, for discussion only

@@ -76,7 +76,7 @@ const checkRequesterPaysError = async (response): Promise<RequesterPaysErrorInfo
};

export const responseContainsRequesterPaysError = (responseText) => {
return _.includes('requester pays', responseText);
return _.includes('to user project', responseText);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function needs to know how to recognize requester-pays problems from the Rawls bucketOptions API. I don't know the best way to do this; "to user project" is probably way too generic

@@ -22,7 +22,7 @@ export type { InitializedWorkspaceWrapper } from 'src/libs/state';
export interface StorageDetails {
googleBucketLocation: string; // historically returns defaultLocation if bucket location cannot be retrieved or Azure
googleBucketType: string; // historically returns locationTypes.default if bucket type cannot be retrieved or Azure
fetchedGoogleBucketLocation: 'SUCCESS' | 'ERROR' | undefined; // undefined: still fetching
fetchedGoogleBucketLocation: 'SUCCESS' | 'ERROR' | 'RPERROR' | undefined; // undefined: still fetching
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing the model to distinguish between requester-pays errors with RPERROR and other errors with ERROR

@@ -115,7 +115,7 @@ export const useWorkspace = (namespace, name): WorkspaceDetails => {
if (responseContainsRequesterPaysError(errorText)) {
// loadGoogleBucketLocation will not get called in this case because checkBucketReadAccess fails first,
// but it would also fail with the requester pays error.
setGoogleStorage({ fetchedLocation: 'ERROR', location, locationType });
setGoogleStorage({ fetchedLocation: 'RPERROR', location, locationType });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since this is where we inspect the error to find requester-pays problems (line 115), this is where we can set RPERROR

@@ -60,6 +58,9 @@ export const BucketLocation = requesterPaysWrapper({ onDismiss: _.noop })((props
// while storageDetails.googleBucketLocation will contain the default value.
// In the case of requester pays workspaces, we wish to show the user more information in this case and allow them to link a workspace.
loadGoogleBucketLocation();
} else if (storageDetails.fetchedGoogleBucketLocation === 'RPERROR') {
setNeedsRequesterPaysProject(true);
setLoading(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a case here for RPERROR which sets the proper state. the ERROR case continues to try to reload; this might happen as permissions are being synced.

@davidangb davidangb closed this Nov 15, 2024
@davidangb davidangb deleted the da_rpBucketLocation branch November 15, 2024 20:34
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.

2 participants