twilio / twilio-node

Node.js helper library
MIT License
1.37k stars 495 forks source link

Twillio doesn't work with remix js #987

Open vawogbemi opened 6 months ago

vawogbemi commented 6 months ago

twilio just doesn't work with remix and i've been trying lots of things

Reproduction

import twilio from "twilio";

const accountSid = process.env.TWILIO_ACCOUNT_SID; const authToken = process.env.TWILIO_AUTH_TOKEN; const client = twilio(accountSid, authToken);

client.messages .create({ body: 'This is the ship that made the Kessel Run in fourteen parsecs?', from: process.env.TWILIO_NUMBER, to: '+16476675845' }) .then((message: any) => console.log(message.sid));

System Info

System: OS: macOS 13.5 CPU: (4) x64 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz Memory: 866.66 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node npm: 10.0.0 - ~/.nvm/versions/node/v18.17.1/bin/npm pnpm: 8.8.0 - ~/Library/pnpm/pnpm npmPackages: @remix-run/css-bundle: ^2.0.1 => 2.0.1 @remix-run/dev: ^2.0.1 => 2.0.1 @remix-run/eslint-config: ^2.0.1 => 2.0.1 @remix-run/node: ^2.0.1 => 2.0.1 @remix-run/react: ^2.0.1 => 2.0.1 @remix-run/serve: ^2.0.1 => 2.0.1

Used Package Manager

pnpm

Expected Behavior

twilio api working

Actual Behavior

when i first used require("twilio") i got a dynamic require error

i switched to import twilio and i got polyfill errors

I fixed the errors and now the remix just doesn't load the page that uses twilio. If I click a link to the messaging page, it just refreshes current page