JITSI Docker - JIGSI Trascribe Error with Google Credentials file

Hello, I’m running JITSI Docker with JIGASI and I have the SIP features running OK but I have problems with the transcribe feature

I have followed the instructions on

The JIGASI logs says:

WARNING: Google Credentials are not properly set
java.io.IOException: Error reading credential file from environment variable GOOGLE_APPLICATION_CREDENTIALS, value '/config/key.json': Invalid PKCS#8 data.
        at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:165)
        at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentials(DefaultCredentialsProvider.java:126)
        at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:125)
        at com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(GoogleCredentials.java:97)
        at org.jitsi.jigasi.transcription.GoogleCloudTranscriptionService.isConfiguredProperly(GoogleCloudTranscriptionService.java:299)
        at org.jitsi.jigasi.TranscriptionGatewaySession.onConferenceCallStarted(TranscriptionGatewaySession.java:181)
        at org.jitsi.jigasi.TranscriptionGatewaySession.onConferenceCallInvited(TranscriptionGatewaySession.java:163)
        at org.jitsi.jigasi.JvbConference$JvbCallListener.incomingCallReceived(JvbConference.java:1410)
        at net.java.sip.communicator.service.protocol.media.AbstractOperationSetBasicTelephony.fireCallEvent(AbstractOperationSetBasicTelephony.java:206)
        at net.java.sip.communicator.service.protocol.media.AbstractOperationSetBasicTelephony.fireCallEvent(AbstractOperationSetBasicTelephony.java:165)
        at net.java.sip.communicator.impl.protocol.jabber.CallJabberImpl.processSessionInitiate(CallJabberImpl.java:1129)
        at net.java.sip.communicator.impl.protocol.jabber.OperationSetBasicTelephonyJabberImpl.lambda$processJingleIQ$0(OperationSetBasicTelephonyJabberImpl.java:1095)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: Invalid PKCS#8 data.
        at com.google.auth.oauth2.ServiceAccountCredentials.privateKeyFromPkcs8(ServiceAccountCredentials.java:451)
        at com.google.auth.oauth2.ServiceAccountCredentials.fromPkcs8(ServiceAccountCredentials.java:440)
        at com.google.auth.oauth2.ServiceAccountCredentials.fromJson(ServiceAccountCredentials.java:203)
        at com.google.auth.oauth2.GoogleCredentials.fromStream(GoogleCredentials.java:172)
        at com.google.auth.oauth2.DefaultCredentialsProvider.getDefaultCredentialsUnsynchronized(DefaultCredentialsProvider.java:159)
        ... 12 more

I have made several tests and I cant get it to work.
My last test was to install Google Cloud CLI and use the same Google Credentials file that JIGASI uses: ~/.jitsi-meet-cfg/jigasi/key.json, It didnt work , google CLI reports an error with the format of the file (this is the file autogenerate by docker-compose with the google credentials at .ENV file)
Then I replaced this “autogenerated” file with the original file that I downloaded from Google cloud and I have copied the file to replace ~/.jitsi-meet-cfg/jigasi/key.json and then I have tested Google cloud CLI and works OK with that credential file
I have stoped and started docker-compose to test JITSI with the new key.json file that DOES work with google cloud CLI and I get the same JIGASI ERROR: GOOGLE_APPLICATION_CREDENTIALS, value ‘/config/key.json’: Invalid PKCS#8

Please help, what else can I do.

I have made another test and I got it working with my downloaded credentials file from google

some how the credentials file didnt get copied to the JITSI config folder or it was overwritten by the docker-compose stop/start

I think there is something to review with the creation of this file when docker-compose starts. I have seen a difference from my downloaded file and the autogenerated file that new line characters are with two backslash.
In the original google downloaded file, new lines are: \n
In the autogenerate key file, new lines are: \n

Hi Omar, thanks for reporting back your solution as this may help other users as well!

In the original google downloaded file, new lines are: \n
In the autogenerate key file, new lines are: \\n