twilio / flex-plugin-builder

Packages related to building a Twilio Flex Plugin
https://www.twilio.com/docs/flex/developer/plugins/cli
MIT License
83 stars 55 forks source link

[BUG] Flex Plugin isn't upgrading to the latest version #1034

Closed rajanpam closed 1 week ago

rajanpam commented 3 weeks ago

Description

I am trying to upgrade the twilio flex plugin to the latest version 7.0.1, but the installation log shows version 6.4.2 being installed and I also get the message:

The Flex Plugins CLI version installed is different from the version used by your plugin. The Plugins CLI version installed is 6.4.2 and the version used by your plugin is 7.0.1. Run the upgrade plugin command to use the installed version.

Installing plugin @twilio-labs/plugin-flex... ⢿ [4/4] Building fresh packages... Installing plugin @twilio-labs/plugin-flex... ⡿ [4/4] Building fresh packages... Installing plugin @twilio-labs/plugin-flex... ⣟ success Saved lockfile. Installing plugin @twilio-labs/plugin-flex... ⣯ success Saved lockfile. Installing plugin @twilio-labs/plugin-flex... ⣷ success Saved lockfile. Installing plugin @twilio-labs/plugin-flex... ⣾ Done in 51.78s. Installing plugin @twilio-labs/plugin-flex... installed v6.4.2

Versions

package version
@twilio/plugin-flex X.Y.Z
flex-plugin-scripts 7.0.1
node 18.19.0
npm 10.2.3

Package.json

{ "name": "flex-plugin-zipwhip", "version": "1.0.0", "private": true, "scripts": { "postinstall": "flex-plugin pre-script-check" }, "dependencies": { "@azure/msal-browser": "^2.33.0", "@azure/msal-react": "^1.5.3", "@twilio-paste/core": "17.0.1", "@twilio-paste/icons": "9.4.0", "@twilio/flex-plugin-scripts": "^7.0.1", "liquidjs": "^10.4.0", "moment": "^2.29.4", "prop-types": "^15.7.2", "react": "17.0.2", "react-dom": "17.0.2", "react-dropdown-tree-select": "^2.7.1", "react-query": "^3.39.2" }, "devDependencies": { "@twilio/flex-ui": "^2", "react-test-renderer": "17.0.2" } }

Steps to Reproduce - Trying to run the pipeline with the below script. After installation of flex plugin it gives the error "The Flex Plugins CLI version installed is different from the version used by your plugin. The Plugins CLI version installed is 6.4.2 and the version used by your plugin is 7.0.1. Run the upgrade plugin command to use the installed version." and before deployment of the plugin it gives a similar error "The plugin flex-plugin-zipwhip version (v7) is not compatible with this CLI command."

Script Start

!/bin/bash

Exit on error

set -e

export TWILIO_ACCOUNT_SID=$1 export TWILIO_API_KEY=$2 export TWILIO_API_SECRET=$3 export BUILD_NUMBER=$4

export NODE_OPTIONS=--openssl-legacy-provider

Check if running on a Debian-based system

if ! command -v apt >/dev/null 2>&1; then echo "This script requires a Debian-based system with 'apt' package manager." exit 1 fi

Update package list

echo "Updating package list..." sudo apt update

Install Node.js if not already installed

if ! command -v node >/dev/null 2>&1; then echo "Installing Node.js..." curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt install -y nodejs else curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install -y nodejs
fi

Install Twilio CLI if not already installed

if ! command -v twilio >/dev/null 2>&1; then echo "Installing Twilio CLI with 'apt'..." curl -s https://twilio-cli-prod.s3.amazonaws.com/twilio_pub.asc | sudo apt-key add - echo "deb https://twilio-cli-prod.s3.amazonaws.com/apt/ /" | sudo tee /etc/apt/sources.list.d/twilio.list sudo apt update sudo apt install -y twilio fi

Install the Twilio Flex plugin to the Twilio CLI

echo "Installing the Twilio Flex plugin to the Twilio CLI..." twilio plugins:install @twilio-labs/plugin-flex

npm i

Deploy the flex plugin

echo "Deploying the flex plugin..." twilio flex:plugins:deploy --version "2.0.$BUILD_NUMBER" --changelog "Troubleshooting deployment" --description "Flex Zipwhip Implementation"

Script End

Expected Behavior

The plugin should be upgraded to 7.0.1 and the deployment should be successful

rajanpam commented 3 weeks ago

Solved my issue, pasting the solution here for anyone who comes across this issue...

Based on the error I have been trying to upgrade the flex plugin CLI version to the latest (7.0.1) without any success. However I ran “npm show @twilio-labs/plugin-flex” command in my local only to realize that the lastest npm package of @twilio-labs/plugin-flex is 6.4.2 which was released 6 days ago. As luck would have it, it was 7.0.1 when we deployed in another branch just last week and now it changed to 6.4.2. https://www.npmjs.com/package/@twilio-labs/plugin-flex?activeTab=versions. Never knew you could go back in your versioning! And the error message was certainly misleading.

So once I changed the value of @twilio/flex-plugin-scripts from 7.0.1 to 6.4.2 in package.json the deployment was successful.

phollaa commented 1 week ago

Hi, this was a bug, and it's fixed now. We have released a new version, 7.0.4, and going forward, running twilio plugins:install @twilio-labs/plugin-flex will always install the latest version.Sorry for the inconvenience. Closing this issue as its fixed. Please feel free to reopen