Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svn+ssh fails with org.gitlab4j.api.GitLabApiException: Failed to return the key #684

Open
joe-flumen opened this issue Oct 10, 2024 · 0 comments

Comments

@joe-flumen
Copy link

joe-flumen commented Oct 10, 2024

Hi,

I was trying to use svn+ssh, got this error

git-as-svn[22133]: Exception in thread "SvnServer-thread-0" org.gitlab4j.api.GitLabApiException: Failed to return the key
git-as-svn[22133]:         at org.gitlab4j.api.AbstractApi.validate(AbstractApi.java:678)
git-as-svn[22133]:         at org.gitlab4j.api.AbstractApi.get(AbstractApi.java:214)
git-as-svn[22133]:         at org.gitlab4j.api.KeysApi.getUserBySSHKeyFingerprint(KeysApi.java:27)
git-as-svn[22133]:         at svnserver.ext.gitlab.auth.GitLabUserDB.lookupByExternal(GitLabUserDB.kt:95)
git-as-svn[22133]:         at svnserver.ext.keys.KeyAuthenticator.authenticate(KeyAuthenticator.kt:33)
git-as-svn[22133]:         at svnserver.server.SvnServer.authenticate(SvnServer.kt:226)
git-as-svn[22133]:         at svnserver.server.SessionContext.authenticate(SessionContext.kt:92)
git-as-svn[22133]:         at svnserver.server.SvnServer.serveClient(SvnServer.kt:110)
git-as-svn[22133]:         at svnserver.server.SvnServer.run$lambda$2(SvnServer.kt:83)
git-as-svn[22133]:         at java.base/java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run(ThreadPerTaskExecutor.java:314)
git-as-svn[22133]:         at java.base/java.lang.VirtualThread.run(VirtualThread.java:329)

After checking the code, I found the problem in this line:

createUser(context.api.keysAPI.getUserBySSHKeyFingerprint(keyId.toString()).user, null)

It tries to get key by fingerprint; while passing key id.

The problem probably arise because gitlab4j doesn't have api called getUserBySSHKeyId.

Solution is to make new version of gitlab4j with the new API (Issue created), use this new version and call the correct API.

Thanks for your awesome work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant