Minor version update from 3.42.2 -> 3.43.0 causes breaking changes on Node version 6.
Problem
Issue Summary I believe the issue is due to a change where the "New-Style" of the URL object is being used without condition of which version of Node is being used. Steps to Reproduce 1. Use Node version 6. 2. Run the usual steps to create a room 3. Get the following error Code Snippet [code block] Exception/Log [code block] Technical details: twilio-node version: 3.43.0 node version: 6.11.3
Error Output
error ### Code Snippet
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Implement Conditional URL Object Usage for Node 6 Compatibility
The breaking change in twilio-node version 3.43.0 utilizes the 'New-Style' URL object without checking the Node.js version. Node 6 does not support the 'New-Style' URL API, leading to runtime errors when attempting to create or manipulate URLs.
Awaiting Verification
Be the first to verify this fix
- 1
Check Node Version
Before using the 'New-Style' URL object, check the Node.js version to ensure compatibility.
javascriptif (process.version.startsWith('v6')) { /* Fallback to Old-Style URL */ } else { /* Use New-Style URL */ } - 2
Modify URL Object Usage
Refactor the code to conditionally use the appropriate URL object based on the Node.js version.
javascriptconst { URL } = (process.version.startsWith('v6')) ? require('url') : require('new-url'); - 3
Test the Changes
Run the application using Node version 6 to ensure that the changes are effective and no errors occur when creating a room.
bashnode your_application.js - 4
Update Documentation
Document the changes made to the codebase, including how to handle URL objects for different Node.js versions.
Validation
Confirm that the application runs without errors on Node version 6 and that the expected functionality (creating a room) works as intended. Additionally, verify that the application runs correctly on newer Node versions.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep