rems icon indicating copy to clipboard operation
rems copied to clipboard

api/audit-log endpoint => 500 server error

Open delocalizer opened this issue 7 months ago • 2 comments

Describe the bug or behavior GET on the api/audit-log endpoint with an appropriately-permissioned user returns a 500 server error mentioning No implementation of method: :write-body-to-stream

curl http://localhost:3000/api/audit-log \
-H "content-type: application/json"   \
-H "x-rems-api-key: xxx" \
-H "x-rems-user-id: yyy"
2025-07-02 16:34:56,037 [jetty-52 rqc:1 reporter ErvRDHkj] INFO  rems.middleware - req > :get /api/audit-log
2025-07-02 16:34:56,044 [jetty-52 rqc:- reporter ErvRDHkj] INFO  rems.middleware - > :get /api/audit-log lang: :en user: {:userid reporter, :name Reporter, :email [email protected]} api-key roles: #{:reporter :logged-in :api-key}
2025-07-02 16:34:56,094 [jetty-52 rqc:1 reporter ErvRDHkj] INFO  rems.middleware - req < :get /api/audit-log 200 56ms 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 No implementation of method: :write-body-to-stream of protocol: #&apos;ring.core.protocols/StreamableResponseBody found for class: clojure.lang.PersistentVector</title>
</head>
<body><h2>HTTP ERROR 500 No implementation of method: :write-body-to-stream of protocol: #&apos;ring.core.protocols/StreamableResponseBody found for class: clojure.lang.PersistentVector</h2>
<table>
<tr><th>URI:</th><td>/api/audit-log</td></tr>
<tr><th>STATUS:</th><td>500</td></tr>
<tr><th>MESSAGE:</th><td>No implementation of method: :write-body-to-stream of protocol: #&apos;ring.core.protocols/StreamableResponseBody found for class: clojure.lang.PersistentVector</td></tr>
<tr><th>SERVLET:</th><td>org.eclipse.jetty.servlet.ServletHandler$Default404Servlet-2241cafe</td></tr>
</table>

</body>
</html>

To Reproduce Steps to reproduce the behavior:

  1. using the latest prebuilt jar from releases
  2. configure a user with reporter role
  3. create an API key for the user
  4. GET on the api/audit-log endpoint

Expected behavior A list of all audit log events. These exist in the database, as confirmed by manual inspection

remsdb=> SELECT COUNT(*) FROM audit_log;
 count 
-------
    51
(1 row)

Environment

  • REMS: v2.38.1
  • OS: Fedora Linux 42
  • Java: openjdk version "21.0.7" 2025-04-15

delocalizer avatar Jul 02 '25 06:07 delocalizer

Thanks for the report!

I have fixed the problem. I think this hasn't perhaps worked before. Turns out we don't have an HTTP level test for this API, so we never bumped into it ourselves.

You can use the fix from my PR #3381 or wait for a release. I'm not sure when a release would be made, especially since it's summer. Perhaps early autumn.

Macroz avatar Jul 02 '25 19:07 Macroz

Thanks @Macroz ! This now works for me as expected.

delocalizer avatar Jul 02 '25 21:07 delocalizer