HumanSignal / HumanSignal/label-studio-ml-backend

Event received without payload raise an exception

Open
#433 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
490
Avg merge
1d 14h
Merged PRs (30d)
3

Description

Hello,

Via Labelstudio frontend, we can choose whether to send or not the payload when the webhook is triggered:
![image](https://github.com/HumanSignal/label-studio-ml-backend/assets/4428209/a4c02af6-ad9e-446a-be82-948d1db7aaa8)
When we deactivate the option of sending the payload, this raises an exception in the api:
https://github.com/HumanSignal/label-studio-ml-backend/blob/e4c579216a74b74ff19d73f46827b3696db6651a/label_studio_ml/api.py#L91
```python
project_id = str(data['project']['id'])
label_config = data['project']['label_config']
```
This looks normal, because according to the [documentation](https://labelstud.io/guide/webhooks#Add-a-webhook-in-Label-Studio-UI):
> (Optional) Select whether to send a payload with the event. By default, payloads are sent. If you don’t send a payload, only the action key is sent. For example, choose to send the payload for Annotation created events to update the correct pipeline based on the project ID sent in the payload.
Which basically means that "project" won't be find in data.

How should we handle this? Should it be the backend api that should send a minimal payload (including project_id and label_config), or should it be the ML backend that should work around the fact that a Model can be created without project_id?

Kind regards

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.