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

Latest dayjs version causes exception in client.messages.create() #934

Closed
pwiebe opened this issue May 15, 2023 · 8 comments
Closed

Latest dayjs version causes exception in client.messages.create() #934

pwiebe opened this issue May 15, 2023 · 8 comments
Labels
status: waiting for feedback waiting for feedback from the submitter type: bug bug in the library

Comments

@pwiebe
Copy link

pwiebe commented May 15, 2023

Issue Summary

Calling client.messages.create() using version 1.11.7 of dayjs throws an exception as shown below. Downgrading to version 1.11.5 resolves the issue.

Steps to Reproduce

  1. send a message using client.messages.create() as shown in the code snippet

Code Snippet

const twilio = require('twilio');
const client = twilio(ACCOUNT_SID, AUTH_TOKEN);

try {
        const result = await client.messages.create({
            to,
            from,
            body,
            statusCallback,
        });
        return result;
} catch (e) {
        console.log(e.message, e.stack);
}

Exception/Log

TypeError: Cannot read properties of null (reading 'constructor')
    at M.r (/Users/node_modules/dayjs/plugin/objectSupport.js:1:412)
    at M.parse (/Users//node_modules/dayjs/plugin/objectSupport.js:1:887)
    at new M (/Users/node_modules/dayjs/dayjs.min.js:1:2038)
    at Function.utc (/Users/node_modules/dayjs/plugin/utc.js:1:402)
    at parseDate (/Users/node_modules/twilio/lib/base/deserialize.js:64:29)
    at Object.rfc2822DateTime (/Users/node_modules/twilio/lib/base/deserialize.js:40:12)
    at new MessageInstance (/Users/node_modules/twilio/lib/rest/api/v2010/account/message.js:126:37)
    at /Users/node_modules/twilio/lib/rest/api/v2010/account/message.js:279:63
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Technical details:

  • twilio-node version: 4.11.0
  • dayjs version: 1.11.7
  • node version: 18.15.0
@AsabuHere
Copy link
Contributor

Hi @pwiebe, Thanks for the heads up!
I tried reproducing this issue, and this works with the latest version 4.11.0. Can you please try the same code with the latest version of twilio?

@AsabuHere AsabuHere added type: bug bug in the library status: waiting for feedback waiting for feedback from the submitter labels May 16, 2023
@Amogh-Gopinathan
Copy link

@AsabuHere I'm getting this error 'TypeError: dayjs_1.default.utc is not a function'
\node_modules\twilio\lib\base\deserialize.js:64:29

@charan678
Copy link

Hello @pwiebe I was checking change logs for dayjs, I found they made changes with objectSupport. People has commented for null values issue there. You can have a look into this link. Let see if they are going to fix this in upcoming releases

@titanism
Copy link
Contributor

We submitted a pull request iamkun/dayjs#2342 and will reach out to the author

@titanism
Copy link
Contributor

Our PR was merged, we are waiting on a new release of dayjs.

@titanism
Copy link
Contributor

titanism commented Jul 1, 2023

v1.11.9 of dayjs was released at iamkun/dayjs#2277 (comment)

please close this issue as this is now resolved

titanism added a commit to titanism/twilio-node that referenced this issue Jul 1, 2023
Per twilio#934 (comment) the version of `dayjs` should be at least `v1.11.9` to avoid an error.
@titanism
Copy link
Contributor

titanism commented Jul 1, 2023

@AsabuHere please see #945

@AsabuHere
Copy link
Contributor

Hi @titanism, Thanks for raising the PR to update the dayjs version. Our team has reviewed and merged the PR.

@pwiebe Please verify the fix using the updated version of dayjs, and feel free to open a new github issue if the issue still persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for feedback waiting for feedback from the submitter type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

5 participants