Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions terra_notebook_utils/drs.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ def access(drs_url: str,
key=info.key,
sa_credentials=info.credentials,
requester_pays_user_project=billing_project)
# one last sanity check
response = requests.get(url, headers={'Range': 'bytes=0-1'})

if response.status_code >= 400:
raise DRSResolutionError(f'Could not generate a valid signed URL for {drs_url} . Make sure you have access '
f'to this file. If you believe you have access, relinking your account projects in '
f'your Terra profile may solve this issue (even if it shows your linking is currently '
f'valid). Otherwise, if you believe you have access and have relinked, please '
f'contact Terra support.')

return url.strip()

def _get_drs_gs_creds(response: dict) -> Optional[dict]:
Expand Down