DantSu / studio

STUdio - Story Teller Unleashed
Mozilla Public License 2.0
37 stars 6 forks source link

Error 500 when calling API #3

Open apic-jeremy opened 8 months ago

apic-jeremy commented 8 months ago

Describe the bug Good morning, I just discovered your version of STUdio (STUdio v0.5.2) and it is much faster than the original :)

On the other hand, I developed a small FRONT tool in Angular to allow me to manage my packs more quickly (mass sending and deletion) and I encountered a problem with your version.

Indeed, when I call certain endpoints, they return me a 500 error.

Note that the embedded front with STUdio works very well. On the other hand, the API call does not crash in version 0.3.1 of STUdio (of Marian).

To Reproduce Here, the code I use to perform actions :

public pushStory(_uuid: string, _path: string) {
        return this.http.post<any>("http://localhost:8080/api/device/addFromLibrary", 
            JSON.stringify({uuid: _uuid, path: _path})
        );
    }

Expected behavior Correct response of API

Logs Logs form debug console of Firefox :

{"error":{"code":500,"message":"Cannot invoke \"io.vertx.core.json.JsonObject.getString(String)\" because the return value of \"io.vertx.ext.web.RoutingContext.getBodyAsJson()\" is null"},"stack":["studio.webui.api.DeviceController.lambda$apiRouter$8(DeviceController.java:54)","io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)","io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:159)","io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100)","io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:157)","io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)","java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)","java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)","io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)","java.base/java.lang.Thread.run(Thread.java:842)"]}

Desktop and environment (please complete the following information):

Additional context Add any other context about the problem here.

MathieuIko commented 4 months ago

If your problem still holds, could you share the full HTTP Request sent by your frontend to the API? The error seems to be related with an empty body (or maybe some missing headers).