Open LaViigand opened 5 years ago
Hi,
ETIMEDOUT means you're getting timeouts when connecting to oauth2.googleapis.com
domain... The issue is not related to gmail-tester.
Please make sure you're not behind a firewall and your internet connection is solid.
@levz0r, I am seeing a similar issue. I do NOT have an error reason ETIMEDOUT
but the rest of the error messaging is the same for me. Any guidance? It randomly appears and is making my tests flakey.
[gmail] Error: TypeError: gmail_emails is not iterable
at _get_recent_email (/Users/md/Devel/qa-automation/node_modules/gmail-tester/gmail-tester.js:37:29)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
@midleman Hey, I need additional information, such as, which version of the lib you are using and the parameters you pass to the function.
@levz0r , i just realized that above that error it clearly states that The API returned an error: Error: User-rate limit exceeded.
. so i run into this frequently, and i'm not sure why as I'm not making a crazy # of requests. i even increased my poll time to see if that would help and it didn't. is it possible to consider integrating quota handling? something like this? https://stackoverflow.com/questions/24983679/gmail-api-users-messages-get-throws-user-rate-limit-exceeded
Hi,
Quota handling is out of the scope of this library... Maybe you have an 3rd-party app which is draining your quota...
Check this out: https://support.google.com/accounts/answer/3466521?hl=en
Hi, there are no 3rd party apps or other integrations with this account (which I just confirmed). This account is strictly for test automation purposes. I'm using your package to get verification emails & links sent to the inbox and that's it. When I'm running these tests more frequently (writing a new one, or debugging an issue) I quickly hit the User-rate limit exceeded error and then I can't resume using/getting messages until 12-24 hours later.
Hi, actually I'm having hard time to understand how it is possible to either reach 1,000,000,000 quota units per day, or 250 requests per second. It is definitely not something gmail-tester
is causing... The problem might be found in your tests (maybe some kind of loop where you invoke the library, or a lot of tests running in parallel?). I'll be thankful if you could share what caused it when you find it out...
Ditto, i'm with you on that sentiment. this is my code. i'm a newb with javascript, so i'm sure i did a lot wrong below :x
export const pollGmailInbox = (from, to, subject) => new Promise(((resolve, reject) => {
cy.task('gmail:check', {
from,
to,
subject,
}).then((email) => {
if (typeof email !== 'undefined') {
resolve(email);
} else {
reject(new Error('Polling inbox timed out. Email not found.'));
}
});
}));
export const getGmailMessage = (from, to, subject) => new Promise(((resolve) => {
pollGmailInbox(from, to, subject).then(() => {
cy.task('gmail:get-messages', {
options: {
include_body: true,
},
}).then((emails) => {
const foundEmail = emails.find(email => (
email.from.indexOf(from) >= 0
&& email.receiver.indexOf(to) >= 0
&& email.subject.indexOf(subject) >= 0
));
assert.isDefined(foundEmail, 'Email Found');
resolve(foundEmail);
});
})
.catch((error) => {
console.log(error.message);
});
}));
export const getVerificationCode = email => new Promise(((resolve) => {
const from = 'no-reply@verificationemail.com';
const subject = 'Verification Email';
getGmailMessage(from, email, subject).then((msg) => {
// eslint-disable-next-line prefer-destructuring
const html = msg.body.html;
assert.isTrue(
html.indexOf('confirmation_code=') >= 0,
'Found verification code!',
);
const code = html.match('confirmation_code=[0-9]*')[0].match('[0-9]*')[0];
resolve(code);
});
}));
same issue, limit reached so quickly hard to understand.
Is that the 0Auth limitation reached? Cuz I found the gmail API requests is far less than the limitation.
Yeah same issue here...
Can someone try sending this application? https://support.google.com/code/contact/oauth_quota_increase
Can someone try sending this application? https://support.google.com/code/contact/oauth_quota_increase
I have tried @levz0r and have not heard anything from them for a long time...
Can someone try sending this application? https://support.google.com/code/contact/oauth_quota_increase
I have tried @levz0r and have not heard anything from them for a long time...
Strange... I got a reply within minutes. In my case, I haven't exceeded my quota, and this is their reply:
Hello Google Cloud Platform / APIs Developer,
Thank you for reaching out. Looks like you already have sufficient OAuth tokens for the project requested as shown here, but in order to resolve this issue, the verification process must be completed.
Please contact oauth-feedback@google.com for further information.
Please review our FAQ or visit the help page, specifically the section title 'Unverified App User Cap' for details.
Sincerely,
Google Cloud Platform / API Trust & Safety Team
I'll try to reach them out and see what I is possible to do...
Official response from OAuth guys:
The https://www.googleapis.com/auth/gmail.readonly scope has become a restricted scope. Any OAuth client that is requesting this scope will need to have this scope verified first before it can be used in an application. More information about the restricted scope verification process can be found in our FAQ.
Best Regards,
OAuth Support Team
I hope it helps.
I just reviewed that documentation and noted the following:
If you are using restricted scopes, you need to submit for verification. You do not need to submit for verification if any of the following applies to your project:
Only owners use the project: if the project is only used by owners of the project, no action is required.
In my case, the project is only used by Owner. If I understand this correctly, I don't need to submit for verification.
Whoo, I'm so glad I found this thread. I've been going through trial and error all night.
Hi @levz0r I am still stuck on running the node script node <node_modules>/gmail-tester/init.js <path-to-credentials.json> <path-to-token.json> <target-email>
.. I've tested this with different scopes but I am still receiving permissions errors. I am guessing that the issues I'm seeing has to do with the restricted scope verification process as well? If not, I can create a new issue.
Here's a little snippet of the error output I get from running the node script:
[gmail] Checking for message from '', to: <my_gmail>@gmail.com, contains '' in subject... The API returned an error: Error: Insufficient Permission Error when getting recent emails: Error: Insufficient Permission [gmail] Error: { Error: Insufficient Permission
Thank you!
Whoo, I'm so glad I found this thread. I've been going through trial and error all night.
Hi @levz0r I am still stuck on running the node script
node <node_modules>/gmail-tester/init.js <path-to-credentials.json> <path-to-token.json> <target-email>
.. I've tested this with different scopes but I am still receiving permissions errors. I am guessing that the issues I'm seeing has to do with the restricted scope verification process as well? If not, I can create a new issue.Here's a little snippet of the error output I get from running the node script:
[gmail] Checking for message from '', to: <my_gmail>@gmail.com, contains '' in subject... The API returned an error: Error: Insufficient Permission Error when getting recent emails: Error: Insufficient Permission [gmail] Error: { Error: Insufficient Permission
Thank you!
Hi @willischu, sorry for the delayed reply. The issue you are having is not related to rate limit, but a general permissions issue. It also has nothing to do with the verification process, as you still should be able to fetch emails using gmail-tester. Please carefully follow the instructions and file a new issue if the instructions unclear. Also, it is worth checking https://github.com/levz0r/gmail-tester/issues/22 and see if you had the same unclarity.
Thank you.
Hi there, just wanted to chime in on an issue I was seeing. Not sure if it's related, but I was getting quota exceeded, hitting the 15k requests per minute violation. This was caused because I was running the init script on an inbox with 15k+ emails. It hangs up on this line:
const gmail_emails = await gmail.get_recent_email(
gmail_client,
oAuth2Client,
query
);
Then it crashes because it was probably checking too fast to see all the emails that match the ""
filter.
I just checked the init.js to filter on some emails that I know weren't so plentiful and it was able to get through it. Hope this helps someone.
Then it crashes because it was probably checking too fast to see all the emails that match the
""
filter.
Yeah! Thank you, this is the solution. The gmail-tester assumes, that we are using newly created mailbox. So - init.js is looking for any e-mail ("Welcome to Gmail…") in inbox, but if there are hundreds of e-mails, it crashes. If I modify init.js like this (and send e-mail with this subject before I run init script), everything works :)
const gmail = require("./gmail-tester");
(async () => {
await gmail.check_inbox(process.argv[2], process.argv[3], {
subject: "Test 123",
from: "",
to: process.argv[4]
});
})();
Hello!
Can someone please have a look at possible issue? Sorry if this is not enough of information - please let me know and I'll reply with more details.
The API returned an error: FetchError: request to https://oauth2.googleapis.com/token failed, reason: connect ETIMEDOUT 172.217.21.138:443 [gmail] Error: TypeError: gmail_emails is not iterable at _get_recent_email (C:\projects\cypress-test\node_modules\gmail-tester\gmail-tester.js:37:29) at
at process._tickCallback (internal/process/next_tick.js:188:7)