Skip to content

Commit 7d430e6

Browse files
debug funnel s3 request format
1 parent 41d3e7e commit 7d430e6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

gen3workflow/routes/s3.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def get_access_token(headers: Headers) -> Tuple[str, str]:
4242
a client_credentials token
4343
"""
4444
auth_header = headers.get("authorization")
45-
logger.info(f"DEBUG: auth_header = {auth_header}")
4645
if not auth_header:
4746
return "", ""
4847
if auth_header.lower().startswith("bearer"):
@@ -55,10 +54,7 @@ def get_access_token(headers: Headers) -> Tuple[str, str]:
5554
else: # format 2 (see docstring)
5655
access_key_id = auth_header.split("AWS ")[1]
5756
access_key_id = ":".join(access_key_id.split(":")[:-1])
58-
logger.info(f"DEBUG: access_key_id = {access_key_id}")
5957
access_token, user_id = access_key_id.split(";userId=")
60-
logger.info(f"DEBUG: access_token = {access_token}")
61-
logger.info(f"DEBUG: user_id = {user_id}")
6258
return access_token, user_id
6359
except Exception as e:
6460
logger.error(
@@ -149,6 +145,8 @@ async def s3_endpoint(path: str, request: Request):
149145
api_endpoint = "/".join(request_path.split("/")[1:])
150146

151147
body = await request.body()
148+
logger.info(f"DEBUG: request.body = {body}")
149+
logger.info(f"DEBUG: request.headers = {request.headers}")
152150
body_hash = hashlib.sha256(body).hexdigest()
153151
timestamp = request.headers["x-amz-date"]
154152
date = timestamp[:8] # the date portion (YYYYMMDD) of the timestamp
@@ -161,6 +159,7 @@ async def s3_endpoint(path: str, request: Request):
161159
# over multiple chunks), we still replace it with the body hash (because I couldn't get the
162160
# signing to work for "STREAMING-AWS4-HMAC-SHA256-PAYLOAD" - I believe it requires using the signature from the previous chunk).
163161
# NOTE: This may cause issues when large files are _actually_ uploaded over multiple chunks.
162+
# TODO test with an input file >5go
164163
headers = {
165164
"host": f"{user_bucket}.s3.amazonaws.com",
166165
"x-amz-content-sha256": body_hash,

0 commit comments

Comments
 (0)