feat(chalice): handle missing payload deadlock
This commit is contained in:
parent
c480c24606
commit
978f936c28
9 changed files with 44 additions and 34 deletions
|
|
@ -155,7 +155,7 @@ async def add_edit_sentry(projectId: int, data: schemas.SentrySchema = Body(...)
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/sentry', tags=["integrations"])
|
||||
async def delete_sentry(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_sentry(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ async def add_edit_datadog(projectId: int, data: schemas.DatadogSchema = Body(..
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/datadog', tags=["integrations"])
|
||||
async def delete_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_datadog(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ async def add_edit_stackdriver(projectId: int, data: schemas.StackdriverSchema =
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/stackdriver', tags=["integrations"])
|
||||
async def delete_stackdriver(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_stackdriver(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ async def add_edit_newrelic(projectId: int, data: schemas.NewrelicSchema = Body(
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/newrelic', tags=["integrations"])
|
||||
async def delete_newrelic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_newrelic(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ async def add_edit_rollbar(projectId: int, data: schemas.RollbarSchema = Body(..
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/rollbar', tags=["integrations"])
|
||||
async def delete_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_datadog(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ async def add_edit_bugsnag(projectId: int, data: schemas.BugsnagSchema = Body(..
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/bugsnag', tags=["integrations"])
|
||||
async def delete_bugsnag(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_bugsnag(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -300,7 +300,7 @@ async def add_edit_cloudwatch(projectId: int, data: schemas.CloudwatchSchema = B
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/cloudwatch', tags=["integrations"])
|
||||
async def delete_cloudwatch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_cloudwatch(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ async def add_edit_elasticsearch(projectId: int, data: schemas.ElasticsearchSche
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/elasticsearch', tags=["integrations"])
|
||||
async def delete_elasticsearch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_elasticsearch(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ async def add_edit_sumologic(projectId: int, data: schemas.SumologicSchema = Bod
|
|||
|
||||
|
||||
@app.delete('/{projectId}/integrations/sumologic', tags=["integrations"])
|
||||
async def delete_sumologic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_sumologic(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ async def add_edit_github(data: schemas.GithubSchema = Body(...),
|
|||
|
||||
|
||||
@app.delete('/integrations/issues', tags=["integrations"])
|
||||
async def delete_default_issue_tracking_tool(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_default_issue_tracking_tool(_=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None and integration is None:
|
||||
|
|
@ -416,7 +416,7 @@ async def delete_default_issue_tracking_tool(context: schemas.CurrentContext = D
|
|||
|
||||
|
||||
@app.delete('/integrations/jira', tags=["integrations"])
|
||||
async def delete_jira_cloud(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_jira_cloud(_=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_jira_cloud.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
|
|
@ -427,7 +427,7 @@ async def delete_jira_cloud(context: schemas.CurrentContext = Depends(OR_context
|
|||
|
||||
|
||||
@app.delete('/integrations/github', tags=["integrations"])
|
||||
async def delete_github(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_github(_=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_github.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
|
|
@ -532,7 +532,8 @@ async def edit_metadata(projectId: int, index: int, data: schemas.MetadataBasicS
|
|||
|
||||
|
||||
@app.delete('/{projectId}/metadata/{index}', tags=["metadata"])
|
||||
async def delete_metadata(projectId: int, index: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_metadata(projectId: int, index: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return metadata.delete(tenant_id=context.tenant_id, project_id=projectId, index=index)
|
||||
|
||||
|
||||
|
|
@ -607,7 +608,8 @@ async def update_alert(projectId: int, alertId: int, data: schemas.AlertSchema =
|
|||
|
||||
|
||||
@app.delete('/{projectId}/alerts/{alertId}', tags=["alerts"])
|
||||
async def delete_alert(projectId: int, alertId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_alert(projectId: int, alertId: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return alerts.delete(project_id=projectId, alert_id=alertId)
|
||||
|
||||
|
||||
|
|
@ -684,7 +686,7 @@ async def edit_project(projectId: int, data: schemas.CreateProjectSchema = Body(
|
|||
|
||||
|
||||
@app.delete('/projects/{projectId}', tags=['projects'])
|
||||
async def delete_project(projectId, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_project(projectId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return projects.delete(tenant_id=context.tenant_id, user_id=context.user_id, project_id=projectId)
|
||||
|
||||
|
||||
|
|
@ -763,7 +765,7 @@ async def get_slack_webhook(webhookId: int, context: schemas.CurrentContext = De
|
|||
|
||||
|
||||
@app.delete('/integrations/slack/{webhookId}', tags=["integrations"])
|
||||
async def delete_slack_integration(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_slack_integration(webhookId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return webhook.delete(tenant_id=context.tenant_id, webhook_id=webhookId)
|
||||
|
||||
|
||||
|
|
@ -779,7 +781,7 @@ async def get_webhooks(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
|
||||
@app.delete('/webhooks/{webhookId}', tags=["webhooks"])
|
||||
async def delete_webhook(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_webhook(webhookId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": webhook.delete(tenant_id=context.tenant_id, webhook_id=webhookId)}
|
||||
|
||||
|
||||
|
|
@ -794,7 +796,7 @@ async def reset_reinvite_member(memberId: int, context: schemas.CurrentContext =
|
|||
|
||||
|
||||
@app.delete('/client/members/{memberId}', tags=["client"])
|
||||
async def delete_member(memberId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_member(memberId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.delete_member(tenant_id=context.tenant_id, user_id=context.user_id, id_to_delete=memberId)
|
||||
|
||||
|
||||
|
|
@ -834,7 +836,8 @@ async def update_saved_search(projectId: int, search_id: int, data: schemas.Save
|
|||
|
||||
|
||||
@app.delete('/{projectId}/saved_search/{search_id}', tags=["savedSearch"])
|
||||
async def delete_saved_search(projectId: int, search_id: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_saved_search(projectId: int, search_id: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": saved_search.delete(project_id=projectId, user_id=context.user_id, search_id=search_id)}
|
||||
|
||||
|
||||
|
|
@ -883,7 +886,8 @@ async def edit_msteams_integration(webhookId: int, data: schemas.EditCollaborati
|
|||
|
||||
|
||||
@app.delete('/integrations/msteams/{webhookId}', tags=["integrations"])
|
||||
async def delete_msteams_integration(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_msteams_integration(webhookId: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return webhook.delete(tenant_id=context.tenant_id, webhook_id=webhookId)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ async def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNote
|
|||
|
||||
|
||||
@app.delete('/{projectId}/notes/{noteId}', tags=["sessions", "notes"])
|
||||
async def delete_note(projectId: int, noteId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_note(projectId: int, noteId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.delete(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId)
|
||||
return data
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ async def update_dashboard(projectId: int, dashboardId: int, data: schemas.EditD
|
|||
|
||||
|
||||
@app.delete('/{projectId}/dashboards/{dashboardId}', tags=["dashboard"])
|
||||
async def delete_dashboard(projectId: int, dashboardId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_dashboard(projectId: int, dashboardId: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return dashboards.delete_dashboard(project_id=projectId, user_id=context.user_id, dashboard_id=dashboardId)
|
||||
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ async def update_widget_in_dashboard(projectId: int, dashboardId: int, widgetId:
|
|||
|
||||
|
||||
@app.delete('/{projectId}/dashboards/{dashboardId}/widgets/{widgetId}', tags=["dashboard"])
|
||||
async def remove_widget_from_dashboard(projectId: int, dashboardId: int, widgetId: int,
|
||||
async def remove_widget_from_dashboard(projectId: int, dashboardId: int, widgetId: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return dashboards.remove_widget(project_id=projectId, user_id=context.user_id, dashboard_id=dashboardId,
|
||||
widget_id=widgetId)
|
||||
|
|
@ -264,5 +265,6 @@ async def update_custom_metric_state(projectId: int, metric_id: int,
|
|||
@app.delete('/{projectId}/cards/{metric_id}', tags=["dashboard"])
|
||||
@app.delete('/{projectId}/metrics/{metric_id}', tags=["dashboard"])
|
||||
@app.delete('/{projectId}/custom_metrics/{metric_id}', tags=["customMetrics"])
|
||||
async def delete_custom_metric(projectId: int, metric_id: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_custom_metric(projectId: int, metric_id: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": custom_metrics.delete(project_id=projectId, user_id=context.user_id, metric_id=metric_id)}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ async def get_user_details(projectKey: str, userId: str):
|
|||
|
||||
|
||||
@app_apikey.delete('/v1/{projectKey}/users/{userId}', tags=["api"])
|
||||
async def schedule_to_delete_user_data(projectKey: str, userId: str):
|
||||
async def schedule_to_delete_user_data(projectKey: str, userId: str, _=Body(None)):
|
||||
projectId = projects.get_internal_project_id(projectKey)
|
||||
if projectId is None:
|
||||
return {"errors": ["invalid projectKey"]}
|
||||
|
|
@ -83,7 +83,7 @@ async def get_job(projectKey: str, jobId: int):
|
|||
|
||||
|
||||
@app_apikey.delete('/v1/{projectKey}/jobs/{jobId}', tags=["api"])
|
||||
async def cancel_job(projectKey: str, jobId: int):
|
||||
async def cancel_job(projectKey: str, jobId: int, _=Body(None)):
|
||||
job = jobs.get(job_id=jobId)
|
||||
job_not_found = len(job.keys()) == 0
|
||||
|
||||
|
|
|
|||
|
|
@ -108,10 +108,10 @@ async def process_trace(action: str, path_format: str, request: Request, respons
|
|||
return
|
||||
current_context: CurrentContext = request.state.currentContext
|
||||
body: json = None
|
||||
if request.method in ["POST", "PUT"]:
|
||||
if request.method in ["POST", "PUT", "DELETE"]:
|
||||
try:
|
||||
body = await request.json()
|
||||
except json.decoder.JSONDecodeError:
|
||||
except Exception:
|
||||
pass
|
||||
intersect = list(set(body.keys()) & set(IGNORE_IN_PAYLOAD))
|
||||
for attribute in intersect:
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ rm -rf ./chalicelib/core/assist.py
|
|||
rm -rf ./auth/__init__.py
|
||||
rm -rf ./auth/auth_apikey.py
|
||||
rm -rf ./build.sh
|
||||
rm -rf ./build_crons.sh
|
||||
rm -rf ./routers/base.py
|
||||
rm -rf ./routers/core.py
|
||||
rm -rf ./routers/crons/core_crons.py
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ async def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNote
|
|||
|
||||
@app.delete('/{projectId}/notes/{noteId}', tags=["sessions", "notes"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
async def delete_note(projectId: int, noteId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_note(projectId: int, noteId: int, _=Body(None), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.delete(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId)
|
||||
return data
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ async def edit_role(roleId: int, data: schemas_ee.RolePayloadSchema = Body(...),
|
|||
|
||||
|
||||
@app.delete('/client/roles/{roleId}', tags=["client", "roles"])
|
||||
async def delete_role(roleId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def delete_role(roleId: int, _=Body(None), context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
data = roles.delete(tenant_id=context.tenant_id, user_id=context.user_id, role_id=roleId)
|
||||
if "errors" in data:
|
||||
return data
|
||||
|
|
@ -112,7 +112,8 @@ async def update_record(projectId: int, recordId: int, data: schemas_ee.AssistRe
|
|||
|
||||
|
||||
@app.delete('/{projectId}/assist/records/{recordId}', tags=["assist"])
|
||||
async def delete_record(projectId: int, recordId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def delete_record(projectId: int, recordId: int, _=Body(None),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
result = assist_records.delete_record(project_id=projectId, record_id=recordId, context=context)
|
||||
if "errors" in result:
|
||||
return result
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ async def update_dashboard(projectId: int, dashboardId: int, data: schemas.EditD
|
|||
|
||||
|
||||
@app.delete('/{projectId}/dashboards/{dashboardId}', tags=["dashboard"])
|
||||
async def delete_dashboard(projectId: int, dashboardId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_dashboard(projectId: int, dashboardId: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return dashboards.delete_dashboard(project_id=projectId, user_id=context.user_id, dashboard_id=dashboardId)
|
||||
|
||||
|
||||
|
|
@ -79,7 +80,7 @@ async def update_widget_in_dashboard(projectId: int, dashboardId: int, widgetId:
|
|||
|
||||
|
||||
@app.delete('/{projectId}/dashboards/{dashboardId}/widgets/{widgetId}', tags=["dashboard"])
|
||||
async def remove_widget_from_dashboard(projectId: int, dashboardId: int, widgetId: int,
|
||||
async def remove_widget_from_dashboard(projectId: int, dashboardId: int, widgetId: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return dashboards.remove_widget(project_id=projectId, user_id=context.user_id, dashboard_id=dashboardId,
|
||||
widget_id=widgetId)
|
||||
|
|
@ -266,5 +267,6 @@ async def update_custom_metric_state(projectId: int, metric_id: int,
|
|||
@app.delete('/{projectId}/cards/{metric_id}', tags=["dashboard"])
|
||||
@app.delete('/{projectId}/metrics/{metric_id}', tags=["dashboard"])
|
||||
@app.delete('/{projectId}/custom_metrics/{metric_id}', tags=["customMetrics"])
|
||||
async def delete_custom_metric(projectId: int, metric_id: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_custom_metric(projectId: int, metric_id: int, _=Body(None),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": custom_metrics.delete(project_id=projectId, user_id=context.user_id, metric_id=metric_id)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue