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

UnhandledPromiseRejectionWarning: Error: Cannot get TKK #1

Open
h4xhor opened this issue Oct 5, 2021 · 2 comments
Open

UnhandledPromiseRejectionWarning: Error: Cannot get TKK #1

h4xhor opened this issue Oct 5, 2021 · 2 comments

Comments

@h4xhor
Copy link

h4xhor commented Oct 5, 2021

Hi Frully, thanks for creating this repo.

I have an issue. So what I did was:

npm install html-google-translate --save

Then I have this code:

const translate = require('html-google-translate');

async function testTransHtml() {    
  const html = '<p><i>I</i> love <a href="#">you</a>!</p>'    
       
  const transHtml = await translate(html, {    
    from: 'en',                                                                                            
    to: 'es',    
  })    
}    
     
testTransHtml();

When I run it I get this error:

(node:92502) UnhandledPromiseRejectionWarning: Error: Cannot get TKK.
    at /home/sum/sum/progs/js/node_modules/@frully/google-translate-open-api/dist/token.js:116:31
    at step (/home/sum/sum/progs/js/node_modules/@frully/google-translate-open-api/dist/token.js:44:23)
    at Object.next (/home/sum/sum/progs/js/node_modules/@frully/google-translate-open-api/dist/token.js:25:53)
    at fulfilled (/home/sum/sum/progs/js/node_modules/@frully/google-translate-open-api/dist/token.js:16:58)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:92502) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:92502) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Any help greatly appreciated.

@CrazyH2
Copy link

CrazyH2 commented Sep 3, 2023

Same @Frully

@milahu
Copy link

milahu commented Oct 4, 2023

$ grep -r 'Cannot get TKK.' node_modules/
node_modules/.pnpm/@frully+google-translate-open-api@1.4.3/node_modules/@frully/google-translate-open-api/dist/token.js:                        throw new Error('Cannot get TKK.');

so this is an upstream issue in Frully/google-translate-open-api

the parent project hua1995116/google-translate-open-api fails with http 403: hua1995116/google-translate-open-api#22

a similar project matheuss/google-translate-api also fails with http 403: matheuss/google-translate-api#79

... all these projects are outdated

these may work better:

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

3 participants