# Error in loading Twilio module in backend

**URL:** <https://forum.wixstudio.com/t/error-in-loading-twilio-module-in-backend/1116>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [April 21, 2023, 3:53pm UTC](https://forum.wixstudio.com/t/error-in-loading-twilio-module-in-backend/1116 "2023-04-21T15:53:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![siliconvalleywoodtur](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@siliconvalleywoodtur](https://forum.wixstudio.com/u/siliconvalleywoodtur)\
**Post date:** [April 21, 2023, 3:53pm UTC](https://forum.wixstudio.com/t/error-in-loading-twilio-module-in-backend/1116/1 "2023-04-21T15:53:43Z")

</div>

I have installed twilio from npm and it shows in my list of packages as twilio [v.4.9.0].

I have the following statement in a backend .jsw module

import twilio from ‘twilio’;

Yet it gives me the following error

“message”:“[“Error loading web module backend/profile.jsw: Cannot find module ‘twilio’\nRequire stack:\n- /user-code/backend/profile.jsw\n- /user-code/stubmodule-that-does-the-require.js\n- /cloud-runtime-code/node\_modules/scoped-require/index.js\n- /cloud-runtime-code/packages/elementory/cloud-runtime/factories.js\n- /cloud-runtime-code/packages/elementory/cloud-runtime/create-app.js\n- /cloud-runtime-code/packages/elementory/cloud-runtime/cloud-grid-runner.js”]”

This is the same code I used for another website, and it used to work. The only difference is the other one was twilio [v.3.55.0] and not [v.4.9.0]

It loads perfectly fine if I put the code in a client side file.

Please help.

My backend code:

import twilio **from** ‘twilio’ ;  
import { getSecret } **from** ‘wix-secrets-backend’ ;

**export async function** testSMS ( )  
{  
console . log ( ‘Inside testSMS in backend/testTwilio’ );

```
**const** accountSID = **await** getSecret ( "T_SID" ); 
**const** authToken = **await** getSecret ( "T_TOKEN" ); 
**const** from_pn = **await** getSecret ( "T_PN" ); 

**let** client = **new** twilio ( accountSID , authToken ); 
**let** pnStr = '+14085550101' ; // This is just a fake number. 
**return**  **await** client . messages . create ({ 
    body : 'test' , 
    to : pnStr , 
    **from** : from_pn 
}); 

```

}

![](https://us1.discourse-cdn.com/wix/original/3X/f/6/f6fcfa59d72f3fea7c7f1bfc7946a8a18fef4849.png)
