Skip to content

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

Open
@joe-flumen

Description

@joe-flumen

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions