nylas/nylas-nodejs

No response on ```.messages.list({ in: 'inbox' })```

amansharmaagami opened this issue ยท 12 comments

Whenever I fetch the messages from Nylas SDK it does not give response from function.

However, it shows the 200 success in API logs.
I'm sharing the screenshot of API log

image

SDK Version:
6.4.1

Same thing happening on .messages.find(messageId);

Hey @amansharmaagami! Thanks for opening this issue, we're going to take a look and get back to you on this.

Its been 10 days our SaaS depends on the SDK, should we go ahead & implement API instead?

@amansharmaagami Sorry for the delay! I've tried to reproduce this problem a number of ways on 6.4.1 but I was not able to. Can you try the same call but also with .messages.list({ in: 'inbox', limit: 1 }) to see if maybe the call is being hung up? Additionally I have a few followup questions:

  • Are you able to get a response using the API directly with the same access token/account?
  • Was this working on a previous SDK version, but broke when upgrading to 6.4.1?
  • Do you have any more of a code snippet/reproduction steps you can share so we can try to reproduce this issue more?

Once again apologies for the delay. Any more information can help us with tracking this issue down.

@mrashed-dev

  • Yes we are able to get the response using API.
  • We haven't test old SDK version.
  • We have following code snippet.

NOTE:- we are using express

const Nylas = require('nylas');
const nylas = Nylas.with(--access-token--);
function getEmails (req, res) {
  try {
       const emails = nylas.messages.list({ in: 'inbox' });
       res.send(emails);
  } catch (err) {
      res.status(500).send(err);
  }
}


function getEmail (req, res) {
  try {
       const email = nylas.messages.find(req.params.id);
       res.send(email);
  } catch (err) {
      res.status(500).send(err);
  }
}

It is worth noticing :- We are not passing any limit here, can it be network issue ?
also the behaviour is only for some specific emails, however we are not able to what kind of specific emails.
Sometimes inbox is working fine, then an email arrives in the inbox it is unresponsive now.

@amansharmaagami Thanks for all these details!

Regarding the networking concern, the SDK currently does not support pagination so it fetches all emails in the account that match your parameters. Meaning that if you have a large amount of emails in the inbox of certain accounts, the call might take a while to complete. Not sure if you have any interceptors or timeout overrides in your application that might drop the connection before it completes? This isn't guaranteed to be happening, just a possibility!

I'll let you know if I'm able to reproduce it, else I'll escalate the issue to see if our support team can take a direct look into why those calls in your application are not forwarding responses to the SDK.

Do SDK fetch more than 100 messages on a request?
because API has default limit of 100.

@amansharmaagami Yes, the SDK doesn't have any pagination support at the moment so it fetches all entries that match. Which means, for example, if an account has 200 emails it will fetch all 200. We're working on adding this feature in the next major release in order to keep parity and behaviour aligned with the API.

Hi @amansharmaagami. I'm sorry to hear that you've been having trouble. I've contacted our support team to see what we can do to diagnose the problem and recommend next steps.

Hi @amansharmaagami! Checking in.

Our support team reached back out last week via the ticket your team has open with them. If you can check in there, that will be the best place to get your issue triaged and addressed.

Let me know if you're not sure how to continue the conversation with our support team.

@ashryanbeats thanks for setting up the support ticket.

Closing this ticket, @amansharmaagami thanks for your patience on this. Don't hesitate to reach out again if you encounter any other issues!

Now, We are using the API with limit so current implementation is doing fine.
Thanks for following up much appreciated.