Skip to content

Commit

Permalink
logging on webhook post error
Browse files Browse the repository at this point in the history
  • Loading branch information
voynow committed Oct 9, 2024
1 parent cd3d688 commit 8875dfe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 46 deletions.
39 changes: 0 additions & 39 deletions test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -213,45 +213,6 @@
"# response.json()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"No rates present in response headers\n"
]
}
],
"source": [
"from src.supabase_client import get_user\n",
"from src.auth_manager import get_strava_client\n",
"\n",
"user = get_user(104454087)\n",
"strava_client = get_strava_client(user.athlete_id)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
11 changes: 6 additions & 5 deletions tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@
from freezegun import freeze_time

from src.auth_manager import get_strava_client
from src.lambda_function import daily_executor
from src.supabase_client import get_user
from src.types.update_pipeline import ExeType
from src.types.user_row import UserRow
from src.update_pipeline import training_week_update_executor


def daily_executor_wrapper(date_str: str):
def daily_executor_wrapper(date_str: str, exetype: ExeType):

day = datetime.datetime.strptime(date_str, "%Y-%m-%d").strftime("%A")
print(f"E2E execution at {date_str} ({day})")

@freeze_time(f"{date_str} 23:59:59")
def test_daily_executor(user: UserRow):
daily_executor(user)
training_week_update_executor(user, exetype)

user = get_user(os.environ["JAMIES_ATHLETE_ID"])
get_strava_client(user.athlete_id)
return test_daily_executor(user)


# New training week
daily_executor_wrapper("2024-09-08")
daily_executor_wrapper("2024-09-08", ExeType.NEW_WEEK)

# Update training week
daily_executor_wrapper("2024-09-09")
daily_executor_wrapper("2024-09-09", ExeType.MID_WEEK)
4 changes: 2 additions & 2 deletions web/src/app/strava_webhook/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export async function POST(request: NextRequest) {
const errorData = await response.json();
console.log(`Error response from signup API: ${JSON.stringify(errorData)}`);
}
} catch (error) {
console.error(`Error occurred while processing POST request: ${error}`);
} catch (error: any) {
console.error(`Error occurred while processing POST request: ${error.message}`);
}
})();

Expand Down

0 comments on commit 8875dfe

Please sign in to comment.