Why I have a EPROTO error in my translator example?

I’m doing the translator example and finally this error shows:

There was an error invoking the function - request to https://(theAPI) failed, reason: write EPROTO ...

No clue what is the problem here, I read something with SSL certification but no idea what means here

Hi @cris1,

Welcome to the Atlassian Developer Community. Very glad to have you here.

I don’t know exactly why this is happening, but let me ask a few things and see if we can understand more or reproduce it:

  • What is the API URL that is leading to this error? Is that the /rest/api/2/issue/${issueKey}?fields=summary,description one or the https://api.cognitive.microsofttranslator.com/translate?api-version=3.0 one? It’s true that the error seems to be related to an SSL certificate and I’m trying to understand the exact conditions when it happens.
  • Does the problem occur both when using forge tunnel and when using the deployed version of the app (so when the forge tunnel is not running)?
  • When is the error logged? I assume that’s when clicking on one of the Translate button but I would like to be sure.

By the way, can you please also do a git pull on the repository? I found and fixed a small issue today and it would be great if you can work with the latest version of the code.

Cheers,
Caterina

Thanks for your response.

Exactly, the error shows it when I click the translate button and is relatable to the https://api.cognitive.microsofttranslator.com/translate?api-version=3.0 call. The error persist on both cases, when is deployed and when is on tunnel.

I did too the small chances you did in the repo, but I think this is other kind of issue.

There is the full stack trace:

There was an error invoking the function - request to https://api.cognitive.microsofttranslator.com.com/translate?api-version=3.0&to=ko failed, reason: write EPROTO 13965015936:error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:…/deps/openssl/openssl/ssl/record/rec_layer_s3.c:1544:SSL alert number 80

Thank you again,

Hey @Cris1 I tested the translator app and also ran into some issues. Not exactly the issue you describe but I was seeing 4xx responses while calling the translator API.

With these changes, I was able to get the translator app working as expected. These have been merged to master so could you try again? There’s one extra setup set now so you’ll have to add the location of the API as an environment variable like: forge variables:set TRANSLATE_API_LOCATION xxxxxxxxxx.

Let me know how you go!

1 Like

Thanks for your reply,

Edit: I dont know if it’s need this part (probably yes), it works without it to me

external:
   fetch: 
     backend:
        - "https://api.cognitive.microsofttranslator.com"

Finally the app works, only 2 notes:

  1. You have to chance your translate API url depending on your region (like said here)
  2. The process.env don’t works, it’s mantains as undefined.
    Edit 2: it only works with the DEBUG variable I don’t know why

Thank you again

Good to hear @Cris1. On the process.env point - make sure you don’t assign to a module level variable like https://bitbucket.org/atlassian/forge-issue-translation/pull-requests/5#Lsrc/index.jsxF7. Module level code is executed during snapshotting on deployment and there are no process.env variables at that point. Try accessing process.env.YOUR_VAR when you need it. Some more details here https://developer.atlassian.com/platform/forge/runtime-reference/#environment-variables