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

Invalid Request Error #109

Open
jaredforth opened this issue Dec 11, 2024 · 2 comments
Open

Invalid Request Error #109

jaredforth opened this issue Dec 11, 2024 · 2 comments

Comments

@jaredforth
Copy link

I have purchased a subscription and am following the docs:

const { Configuration, NopeCHAApi } = require("nopecha");

export const solveHCaptcha = async () => {
  const configuration = new Configuration({
    apiKey: process.env.NOPECHA_API_KEY,
  });
  const nopecha = new NopeCHAApi(configuration);

  const token = await nopecha.solveToken({
    type: "hcaptcha",
    sitekey: "58366d97-3e8c-4b57-a679-4a41c8423be3",
    url: "https://nopecha.com/demo/hcaptcha#easy",
  });

  console.log(token);

  const balance = await nopecha.getBalance();

  console.log(balance);
};

When I run this, the following response is returned:

InvalidRequestError: Invalid request
    at NopeCHAApi.handle_error_response (.../node_modules/nopecha/nopecha.js:143:20)
    at NopeCHAApi.post (.../node_modules/nopecha/nopecha.js:197:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async NopeCHAApi.solve (.../node_modules/nopecha/nopecha.js:204:17)
    at async NopeCHAApi.solveToken (.../node_modules/nopecha/nopecha.js:222:16)

Node.js v20.11.1

Hitting the API directly returns:

{
    "error": 10,
    "message": "Invalid request",
    "type": "Invalid type"
}
@kacperslenzak
Copy link

getting the same error in python using code provided in docs

job_id = requests.post(API, json={
                'type': 'hcaptcha',
                'sitekey': captcha_data['captcha_sitekey'],
                'url': URL,
                'key': KEY,
            })

returning:
{'error': 10, 'message': 'Invalid request', 'type': 'Invalid type'}

Repository owner deleted a comment from GoldenretriverYT Dec 17, 2024
@shoval6
Copy link

shoval6 commented Dec 25, 2024

Are you sure the URL supposed to be : "https://nopecha.com/demo/hcaptcha#easy" ?
according docs : URL where the hCaptcha is found.

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