apache / apache/polaris

`TestOAuth2ApiService` selected in _production_ build

Open
#618 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2.1k
Forks
522
Avg merge
1d 22h
Merged PRs (30d)
137

Description

### Describe the bug

Scenarion:
* Polaris with Eclipselink
* Bootstrapped Polaris
* Starting Polaris
* Running `./polaris principals list`

Yields a runtime exception, HTTP/401 hides the actual cause:

```
INFO [2025-01-07 09:57:15,226 - 3457 ] [dw-93] [] o.a.p.s.d.t.TracingFilter: Started span with parent spanId="ee5c1a62cd73d22d" traceId="13a21ffd612cf2718943bb9bb5492daa" parentContext="{}"
INFO [2025-01-07 09:57:15,249 - 3480 ] [dw-93 - POST /api/catalog/v1/oauth/tokens] [] o.a.p.s.e.IcebergExceptionMapper: Handling runtimeException Failed to read principal entity
INFO [2025-01-07 09:57:15,249 - 3480 ] [dw-93 - POST /api/catalog/v1/oauth/tokens] [] o.a.p.s.e.IcebergExceptionMapper: Handling runtimeException
org.apache.iceberg.exceptions.NotAuthorizedException: Failed to read principal entity
at org.apache.polaris.service.auth.TestOAuth2ApiService.getPrincipalName(TestOAuth2ApiService.java:107)
at org.apache.polaris.service.auth.TestOAuth2ApiService.getToken(TestOAuth2ApiService.java:63)
at org.apache.polaris.service.catalog.api.IcebergRestOAuth2Api.getToken(IcebergRestOAuth2Api.java:113)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:189)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
...
```

### To Reproduce

_No response_

### Actual Behavior

_No response_

### Expected Behavior

_No response_

### Additional context

_No response_

### System information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the stack trace in TestOAuth2ApiService.java and inspect how the production build selects that service, then trace its use through IcebergRestOAuth2Api.java. Reproduce the issue with Polaris using EclipseLink and `./polaris principals list`; done means the production build no longer selects the test OAuth service and the command avoids this runtime authorization failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.