-
Notifications
You must be signed in to change notification settings - Fork 21
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
Da rp bucket location #5168
Conversation
@@ -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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 }); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
DO NOT MERGE, for discussion only