puppeteer-extra-plugin-recaptcha NOT SOLVING CAPTCHAS PROPERLY - puppeteer

Im having an issue solving captchas using puppeteer-extra and puppeteer-extra-plgin-recaptcha. Everything was going very smooth and randomly it broke. It is definitely some issue with not returning the captcha token but im not sure how to fix it. Here is some info.
This is my code initializing it
puppeteer.use(
RecaptchaPlugin({
provider: {
id: '2captcha',
token: 'token' // REPLACE THIS WITH YOUR OWN 2CAPTCHA API KEY ⚡
},
visualFeedback: true // colorize reCAPTCHAs (violet = detected, green = solved)
})
)
This is where i call it
await page.solveRecaptchas()
This is the error
PuppeteerExtraPluginRecaptcha: An error occured during "getRecaptchaSolutions": {
_vendor: 'recaptcha',
provider: '2captcha',
id: '97j1ixpkm2h',
requestAt: 2021-07-24T17:26:54.251Z,
error: 'Error: 2captcha error: Missing response data: undefined'
}
If anyone can help it would be greatly appreciated.

Related

Unexpected token S in JSON at position 0' Next auth

A teammate and I are working developing an application portal. We have the same exact code, node version and environment variables but when he logs in, he gets this error. I am able to login perfectly without any error. He was also able to login last week so at one point it was working for him.
A lot of solutions I've read about are adding code that trims or stringifies the JSON response. But it makes no sense that it works for me as it is but he would need to add code to make his work. Does anyone know why this is happening? (He has a NEXTAUTH_URL in the .env as well).
[next-auth][error][CLIENT_FETCH_ERROR]
https://next-auth.js.org/errors#client_fetch_error invalid json response body at http://localhost:3000/api/auth/session reason: Unexpected token S in JSON at position 0 {
error: {
message: 'invalid json response body at http://localhost:3000/api/auth/session reason: Unexpected token S in JSON at position 0',
stack: 'FetchError: invalid json response body at http://localhost:3000/api/auth/session reason: Unexpected token S in JSON at position 0\n'
I had the same error with next-redux-wrapper. I was implementing the old version's set up. I had this causing error:
export const getServerSideProps = wrapper.getServerSideProps(
async ({ req, params, store }) => {
const session = await getSession({ req });
if (!session) {
return {
redirect: {
destination: "/login",
permanent: false,
},
};
}
await store.dispatch(getBookingDetails(req.headers.cookie, req, params.id));
}
);
I had to change it to:
// the way how I pass callback changed
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ req, params }) => {
....rest of the code
);
I recently encountered exactly the same problem but luckily managed to settle it.
The solution is to (1) NEXT_PUBLIC_SECRET is required in .env and (2) [...nextauth].ts added with secret: process.env.NEXT_PUBLIC_SECRET.
I have the following link to thank for the above solution.
Hope it works for you too.

ShareLinkContent on facebook in android

I encountered 1 problem.
Hope everybody help please.
I have 1 android application using Facebook sdk. Recently Facebook reported that the app violates policy 4.a, (as attached image), So what should I do next to fix this error?
I can't share to facebook using ShareContent, because the dialog appears and then disappears immediately. I received the following error message:
com.facebook.GraphResponse: {HttpStatus: 400, errorCode: 100,
subErrorCode: 33, errorType: GraphMethodException, errorMessage:
Unsupported get request. Object with ID '17837578*******' does not
exist, cannot be loaded due to missing permissions, or does not
support this operation. Please read the Graph API documentation at
https://developers.facebook.com/docs/graph-api}
Following the path in the Bug log, I use the following function:
GraphRequest request = GraphRequest.newMeRequest(
accessToken,
new GraphRequest.GraphJSONObjectCallback() {
#Override
public void onCompleted(JSONObject object, GraphResponse response) {
// Insert your code here
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email");
request.setParameters(parameters);
request.executeAsync();
So what is the
accessToken
here, how to create it?
Thank you everyone for reading.

Unexpected end of Json Input Ionic 3 & Angular 6

I saw many topics about this error but I could not find any solution to mine. I woke up in this morning and served my code and I saw that the error "Unexpected end of Json Input" I changed nothing in my code or versions of my packages. My colleague and I are working on this project and same codes are working well on his computer although we have same packages and versions.
Problem is when I request the server , it response "status 200 ok" but it returns empty "_body" as you see below image.
Here are details of the error :
The sample code is;
console.log(localStorage.getItem("usedURL"));
return new Promise((resolve, reject) => {
let headers = new Headers();
headers.append('Accept', 'application/json');
headers.append('Content-Type', 'application/x-www-form-urlencoded');
this.http.post(localStorage.getItem("usedURL")+"/login", JSON.stringify({ "UserName": credentials.email, "Password": credentials.password }), { headers: headers})
.subscribe(res => {
console.log(res);
resolve(res.json());
}, (err) => {
reject(err);
});
});
However I believe that it is not releated with code. So I tried to clean cache , deleting node modules and re-installing it. Copied all codes from my colleague to my computer but issue has never gone. So anybody has any idea how can I fix this problem ?
Thanks.
Which version of Chrome are you using now? If you using latest version just try downgrade your version :). You're welcome.
If you cannot see the images,
Response;
Response {_body: "", status: 200, ok: true, statusText: "OK", headers: Headers, …}
headers: Headers {_headers: Map(0), _normalizedNames: Map(0)}
ok: true
status: 200
statusText: "OK"
type: 2
url: "http://myapiurl//login"
_body:""
__proto__: Body
Detail of the error;
ERROR SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Response.Body.json (http.js:1091)
at SafeSubscriber._next (account-auth-service.ts:109)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:242)
at SafeSubscriber.next (Subscriber.js:189)
at Subscriber._next (Subscriber.js:129)
at Subscriber.next (Subscriber.js:93)
at XMLHttpRequest.onLoad (http.js:1591)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)
The error you are getting is correct with the response you are getting.
By that I mean that your response body is "", and if you try to JSON.parse("") you will the error you are getting. i.e.,
ERROR SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
So now we found out that the error you are getting is because of the response you are getting. Now we need to know why your API is returning blank string? we don't know since you have not pasted your API login code. Either way you will need to edit your question and add your API login code or create a new question.

Unable to read error response of fb plugin share

I am using cordova-plugin-facebook4 version 1.7.4 for facebook share in my app. I got an error while sharing one post to facebook.
{errorMessage : "Facebook error: {FacebookServiceException: httpResponseCode: -1, facebookErrorCode: 190, facebookErrorType: null, message: Error validating access token: The user has not authorized application XXXXXXXX.}" }
From the facebook docs, I came to know that this error occurs when user de-authorizes my app. So I want to login again and obtain a new access token.
In the Facebook docs, I came to know that facebook sends error code 190 when this error occurs. I am able to see the facebookErrorCode field in my error response.
My problem is I am unable to parse the error response to get the facebook error code. I tried few JSON parse and JSON stringify methods. But nothing worked. I am unable to obtain the error code.
Can anyone help me in parsing the error response and getting the error code ?
UPDATE
Here is my code sample
facebookConnectPlugin.showDialog(
{ method: "share_open_graph",
action: 'og.likes',
object: JSON.stringify({
object:'https://developers.facebook.com/docs/',
})
},
function (response) {
console.log(JSON.stringify(response));
DialogService.showToast('FB_SHARE_SUCCESS', 'Short', 'Bottom');
},
function (response) {
console.log('share failed. ',response);
if(response.errorMessage.facebookErrorCode == 190){
fblogin.then(
function(response){
share();
},
function(error){
//
}
)
}else{
DialogService.showToast('FB_SHARE_FAILED', 'Short', 'Bottom');
}
}
);
I am able to post to facebook if the user authorizes the app for posting.
If the user de-authorizes, I am unable to capture the error code 190.

Identifying (gulp-)eslint error reason

I have this piece of code:
sendMessage(message) {
let data = {
message
};
this.socket.send('message', data);
}
I'm using eslint and set the object-shorthand rule.
"object-shorthand": [
2,
"always"
],
And get this error:
---
message: 'Unexpected token }'
severity: error
data:
line: 39
column: 14
ruleId: ''
...
But why? Any other way to find what rule is being violated?
If I do this:
sendMessage(message) {
let data = {
message: message
};
this.socket.send('message', data);
}
I get this:
---
message: Expected property shorthand.
severity: error
data:
line: 38
column: 17
ruleId: object-shorthand
...
It's clear what's wrong. Great.
So, how can I find what's going on? eslint is asking for object shorthands (as I told it to) but it is not accepting them... For some other reason?
Having these errors showing up all the time is distracting.
Any help is highly appreciated.
(I'm using the latest gulp-eslint: 1.0.0)
My guess is that the fact that eslint says ruleId: '' points to a bug in eslint, not in your code. You should
search in eslint's open issues (I have tried, but found nothing)
if this bug is not reported, produce a minimal code displaying the bug (sorry, I don't have the time to setup things to do so myself)
if successful, open a new issue