Identifying (gulp-)eslint error reason - gulp

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

Related

puppeteer-extra-plugin-recaptcha NOT SOLVING CAPTCHAS PROPERLY

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.

AWS-SDK issue w/ deleteMessageBatch, telling me MissingParameter but I'm not

I'm getting the following message
UnhandledPromiseRejectionWarning: MissingParameter: The request must contain the parameter DeleteMessageBatchRequestEntry.1.Id.
I think I'm following the documentation to a T at AWS-SDK/SQS
I'm using this code
var params = {
Entries: _.map(_.uniqWith(data.Messages,d=>d.MessageId),d=>({
Id: d.MessageId,
ReceiptHandle: d.ReceiptHandle
})),
QueueUrl: xx.QueueUrl
};
await sqs.deleteMessageBatch(params).promise();
This is what params looks like at the time of sending; looks just like the docs if you ask me...
{
Entries: [
{
Id: "83ba1e18-someid",
ReceiptHandle: "AQEB79CDI1Q+blablabla"
}
]
QueueUrl: "https://sqs.us-west-2.amazonaws.com/somequeeuurl"
}
My system:
aws-sdk: "^2.354.0",
MacOS - current
node 8.12.0
UnhandledPromiseRejectionWarning: MissingParameter: The request must contain the parameter DeleteMessageBatchRequestEntry.1.Id.
I just spent a long time looking at this error and debugging my code. What I finally figured out is that it seems to be trying to say that there needs to be at least one DeleteMessageBatchRequestEntry element in the request – there can't be 0. When I refactored our code and added a check to make sure that we wouldn't make a request if there were no entries in the list, this problem went away.
Is it possible that you are actually sending the following in certain situations?
{
Entries: []
QueueUrl: "https://sqs.us-west-2.amazonaws.com/somequeeuurl"
}

Index.js file continuously gives "JSON text did not start with array" despite being formatted as an array

I have a parse-server hosted by heroku, which has an index.js file utilized for its configuration. I want to use Mailgun to up functionality for the user to request a password reset, and I have set up the config file, following this answer, as follows:
var api = new ParseServer({
appName: 'App Name',
publicServerURL: 'https://<name>.herokuapp.com/parse',
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it $
serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse', // Don't$
liveQuery: {
classNames: ["Posts", "Comments"] // List of classes to support for query s$
},
push: JSON.parse(process.env.SERVER_PUSH || "{}"),
verifyUserEmails: true, //causing errors
emailAdapter: { //causing errors
module: 'parse-server-simple-mailgun-adapter',
options: {
fromAddress: 'parse#example.com',
domain: '<domain>',
apiKey: '<key>',
}
}
});
This code does not work, though, because of the verifyUserEmails and emailAdapter. Removing both of them removes the "JSON text did not start with array" error. Adding either one of them back in results in the error being thrown. I have no idea why, though, since I do not see any obvious reason as to how they aren't being set up in an array correctly?
Do I need to set up the cooresponding config vars in heroku in addition to having them in the config file? I considered this, but appName and publicServerURL are not set up in this way and don't give this error.
emailAdapter.options.apiKey doesn't need a comma at the end since its the last element of it's JSON.
I wouldn't be surprised that you're also leaving in the comma at the end of verifyUserEmails when you include it improperly as well.
options: {
fromAddress: 'parse#example.com',
domain: '<domain>',
apiKey: '<key>',
}
This is not valid JSON, because there is a comma at the end of the apiKey line. The last item in a JSON object does not have a comma.
For anyone that is repeatedly running into this issue, I have figured out exactly what was going wrong. Despite the error informing me that my JSON was incorrectly formatted, it turns out it was actually that the module was misnamed. According to this post, the updated module has been renamed to '#parse/simple-mailgun-adapter'. Inserting this into the index.js, after ensuring I had ran the npm install --save #parse/simple-mailgun-adapter in my local repo, fixed the issue.

Drupal 7 Solr Indexing Error showing "EntityMalformedException: Missing bundle property on entity of type taxonomy_term"

In Drupal 7.14, when i Index my Whole Site, Solr is showing following error:
AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows.
Path: /batch?id=1938&op=do StatusText: Service unavailable (with message)
ResponseText: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7539 of /project/path/includes/common.inc).
So when i look into the lines in /includes/common.inc (around lines: 7537):
// Explicitly fail for malformed entities missing the bundle property.
if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
throw new EntityMalformedException(t('Missing bundle property on entity of type #entity_type.', array('#entity_type' => $entity_type)));
}
What is that chunk of code (in common.inc) is doing actually please?
How can i overcome that error?
Please, try this module https://drupal.org/project/taxonomy_orphanage it will delete all empty bundles.

Read single second level JSON entry with Ionic

I've got this JSON file that I'm trying to parse the second level off. But it seems to fail.
{
"error":false,
"accessToken":"xxx",
"accountId":"xxx",
"account":[
{
"error":false,
"id":"2",,
"username":"Username"
}]
}
Here's the Ionic code
return $http.post(SERVER.apiUrl + SERVER.apiLogin,
{username: "username",password: "password"})
.success(function(data){
o.setSession(data.accountId, data.accessToken, data.account[0]["username"]);
});
Error
TypeError: Cannot read property '0' of undefined
at services.js:103
at ionic.bundle.js:17151
at processQueue (ionic.bundle.js:20962)
at ionic.bundle.js:20978
at Scope.$eval (ionic.bundle.js:22178)
at Scope.$digest (ionic.bundle.js:21994)
at Scope.$apply (ionic.bundle.js:22282)
at done (ionic.bundle.js:17439)
at completeRequest (ionic.bundle.js:17629)
at XMLHttpRequest.requestLoaded (ionic.bundle.js:17570)
i have also tried with
data.account.username
and
data.account[0].username
Can anybody give a quick advice?
Best regards
do not understand why it does not work for you, I tried it and does not give me problems.
Although at least here, you put two commas after ID
data.account[0]["username"] Is Ok
 
{
"error":false,
"accessToken":"xxx",
"accountId":"xxx",
"account":[
{
"error":false,
"id":"2",, <-- ERROR
"username":"Username"
}]
}