Skip to content

Commit

Permalink
Pushing logs to prod
Browse files Browse the repository at this point in the history
  • Loading branch information
voynow committed Sep 14, 2024
1 parent 5e81f0c commit 586f3f8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 33 deletions.
3 changes: 2 additions & 1 deletion src/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ def lambda_handler(event, context):
return {"success": True}

elif event.get("trigger_test_key") == os.environ["TRIGGER_TEST_KEY"]:
return daily_executor(get_user(os.environ["JAMIES_ATHLETE_ID"]))
daily_executor(get_user(os.environ["JAMIES_ATHLETE_ID"]))
return {"success": True}

# Catch any error routing or funny business
else:
Expand Down
47 changes: 16 additions & 31 deletions test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -182,50 +182,35 @@
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import os\n",
"\n",
"url = \"https://lwg77yq7dd.execute-api.us-east-1.amazonaws.com/prod/signup\"\n",
"\n",
"response = requests.post(url, json={\n",
" \"trigger_test_key\": os.environ[\"TRIGGER_TEST_KEY\"]\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'errorMessage': \"'str' object has no attribute 'athlete_id'\",\n",
" 'errorType': 'AttributeError',\n",
" 'requestId': '8efbb5cc-cc5e-4a2d-964d-077e27238abf',\n",
" 'stackTrace': [' File \"/var/task/src/lambda_function.py\", line 160, in lambda_handler\\n daily_executor(os.environ[\"JAMIES_ATHLETE_ID\"])\\n',\n",
" ' File \"/var/task/src/lambda_function.py\", line 109, in daily_executor\\n logging.error(f\"Error processing user {user.athlete_id}: {e}\")\\n']}"
"{'errorMessage': 'Unable to marshal response: Object of type TrainingWeek is not JSON serializable',\n",
" 'errorType': 'Runtime.MarshalError',\n",
" 'requestId': '027c4605-c15a-4996-8ca2-31983e150a45',\n",
" 'stackTrace': []}"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"response.json()"
"# import requests\n",
"# import os\n",
"\n",
"# url = \"https://lwg77yq7dd.execute-api.us-east-1.amazonaws.com/prod/signup\"\n",
"\n",
"# response = requests.post(url, json={\n",
"# \"trigger_test_key\": os.environ[\"TRIGGER_TEST_KEY\"]\n",
"# })\n",
"\n",
"# response.json()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
8 changes: 7 additions & 1 deletion web/src/app/verify/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,27 @@ function VerifyContent(): JSX.Element {
router.push(dashboardUrl);
}, 1000);
} else {
throw new Error('Verification failed');
console.error('Verification failed:', data);
throw new Error(`Verification failed: ${JSON.stringify(data)}`);
}
} catch (error) {
console.error('Error during verification:', error);
setStatus('error');
setTimeout(() => router.push('/'), 1500);
}
};

if (code) {
console.log('Verifying with code:', code);
if (email && preferences) {
console.log('Email and preferences found in localStorage');
verifyAccount({ email, preferences, code });
} else {
console.log('Email or preferences missing from localStorage');
verifyAccount({ code });
}
} else {
console.error('No verification code found in URL');
setStatus('error');
setTimeout(() => router.push('/'), 1500);
}
Expand Down

0 comments on commit 586f3f8

Please sign in to comment.