HumanSignal / HumanSignal/label-studio

Local Storage Export - API Endpoint does not work

Open
#5,291 2 comments 1 reaction 0 assignees View on GitHub
community:reviewed
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Describe the bug**
I have a local hosted Label Studio.

The endpoint from the title (as other related with the storage) does not work.
First of all, the documentation lacks information about required argument "path", there is only "project" as a required argument.
The second one, when I call the endpoint correctly I got an 201 code with the message:
```
{"id":7,"type":"localfiles","path":"/home/nolok/label_studio/test_images","regex_filter":null,"use_blob_urls":false,"last_sync":null,"last_sync_count":null,"last_sync_job":null,"status":"queued","traceback":null,"meta":{"attempts":1,"time_queued":"2024-01-13 19:36:39.421572+00:00"},"title":null,"description":null,"created_at":"2024-01-13T19:36:39.411139Z","can_delete_objects":null,"project":5}
```

However, on a project web site in "settings" and "storage" I got an error:
```
Component Stack:
at Qu (http://localhost:8080/react-app/index.js?v=bfd332:2:777125)
at div
at $o.Column (http://localhost:8080/react-app/index.js?v=bfd332:2:648116)
at ec (http://localhost:8080/react-app/index.js?v=bfd332:2:780461)
at div
at $o (http://localhost:8080/react-app/index.js?v=bfd332:2:647900)
at div
at http://localhost:8080/react-app/index.js?v=bfd332:2:616918
at tc
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:521170)
at sentryRoute(t)
at div
at div
at ys (http://localhost:8080/react-app/index.js?v=bfd332:2:682828)
at layout (http://localhost:8080/react-app/index.js?v=bfd332:2:782903)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:522052)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:521170)
at sentryRoute(t)
at Tc (http://localhost:8080/react-app/index.js?v=bfd332:2:797391)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:522052)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:521170)
at sentryRoute(t)
at Tc (http://localhost:8080/react-app/index.js?v=bfd332:2:797391)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:522052)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:521170)
at sentryRoute(t)
at Tc (http://localhost:8080/react-app/index.js?v=bfd332:2:797391)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:522052)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:521170)
at sentryRoute(t)
at Tc (http://localhost:8080/react-app/index.js?v=bfd332:2:797391)
at Gc (http://localhost:8080/react-app/index.js?v=bfd332:2:803310)
at div
at div
at fs (http://localhost:8080/react-app/index.js?v=bfd332:2:677733)
at div
at gs (http://localhost:8080/react-app/index.js?v=bfd332:2:679292)
at Yc (http://localhost:8080/react-app/index.js?v=bfd332:2:803514)
at la (http://localhost:8080/react-app/index.js?v=bfd332:2:651855)
at Bc (http://localhost:8080/react-app/index.js?v=bfd332:2:801503)
at Ac (http://localhost:8080/react-app/index.js?v=bfd332:2:799438)
at bo (http://localhost:8080/react-app/index.js?v=bfd332:2:635777)
at Bi (http://localhost:8080/react-app/index.js?v=bfd332:2:620880)
at http://localhost:8080/react-app/index.js?v=bfd332:2:634810
at ho (http://localhost:8080/react-app/index.js?v=bfd332:2:635505)
at Gi (http://localhost:8080/react-app/index.js?v=bfd332:2:621375)
at t (http://localhost:8080/react-app/index.js?v=bfd332:2:518433)
at qc (http://localhost:8080/react-app/index.js?v=bfd332:2:802391)
at Kc (http://localhost:8080/react-app/index.js?v=bfd332:2:804191)

TypeError: Cannot read properties of null (reading 'slice')
at Qu (http://localhost:8080/react-app/index.js?v=bfd332:2:777625)
at aa (http://localhost:8080/react-app/index.js?v=bfd332:2:423057)
at Ys (http://localhost:8080/react-app/index.js?v=bfd332:2:475182)
at Nl (http://localhost:8080/react-app/index.js?v=bfd332:2:462460)
at Tl (http://localhost:8080/react-app/index.js?v=bfd332:2:462388)
at El (http://localhost:8080/react-app/index.js?v=bfd332:2:462251)
at bl (http://localhost:8080/react-app/index.js?v=bfd332:2:459238)
at http://localhost:8080/react-app/index.js?v=bfd332:2:408976
at t.unstable_runWithPriority (http://localhost:8080/react-app/index.js?v=bfd332:2:503137)
at Vi (http://localhost:8080/react-app/index.js?v=bfd332:2:408753)
at Yi (http://localhost:8080/react-app/index.js?v=bfd332:2:408921)
at Gi (http://localhost:8080/react-app/index.js?v=bfd332:2:408856)
at hl (http://localhost:8080/react-app/index.js?v=bfd332:2:456623)
at Na (http://localhost:8080/react-app/index.js?v=bfd332:2:428353)
at http://localhost:8080/react-app/index.js?v=bfd332:2:781003
```

Is it possible to add a new source storage with API?

**To Reproduce**
Steps to reproduce the behavior:
1. Start label studio locally `label-studio start`
2. Create manually a new project with
3. run the Python code:
```python
import requests
import os

LOCAL_SERVER_PATH = os.getenv("LABEL_STUDIO_LOCAL_FILES_DOCUMENT_ROOT")
TOKEN = os.getenv("LABEL_STUDIO_TOKEN")
headers = {"Authorization": f"Token {TOKEN}"}

def call_api() -> None:
url = "http://localhost:8080/api/storages/export/localfiles"

task_data = {
"project": 5,
"path": f"{LOCAL_SERVER_PATH/test_images"
}

task_response = requests.post(
url,
headers=headers,
json=task_data,
verify=False
)

print(task_response.status_code)
print(task_response.text)

call_api()

```

**Expected behavior**
Is it my fault or the label studio is broken? I got few more errors in api endpoints related with storage, such as `TypeError: can only concatenate list (not "dict") to list`.

**Environment (please complete the following information):**
- OS:
```bash
> uname -a
Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
```
- Label Studio version: 1.10.1dev

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.