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 56 forks source link

[BUG] "Unexpected argument: --bypass-validation" in the latest version #1033

Closed marek-siemieniuk-morawski closed 1 month ago

marek-siemieniuk-morawski commented 2 months ago

Description

We have noticed yesterday that the deployment pipelines stopped working due to:

twilio flex:plugins:deploy --version "$PLUGIN_VERSION" --changelog "$PLUGIN_CHANGELOG" --bypass-validation
 ›   Error: Unexpected argument: --bypass-validation
 ›   See more help with --help

even though we haven't made any changes in the pipelines recently. In the Bitbucket Pipelines logs we can see that the version installed by twilio plugins:install **@twilio-labs/plugin-flex is

Installing plugin @twilio-labs/plugin-flex... installed v6.4.2

I'm attaching the logs and the bitbucket-pipeline.yml:

# https://hub.docker.com/r/twilio/twilio-cli
image: twilio/twilio-cli:latest

definitions:
  caches:
    # Instead of using the pre-defined `node` cache, we define a custom cache with file-based cache keys.
    # Learn more: https://bitbucket.org/blog/announcing-smarter-caches-bitbucket-pipelines
    npm: 
      key: 
        files:
          - package-lock.json
      path: node_modules

    twilio-cli: $HOME/.twilio-cli

  # Reusable steps https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/
  steps:
  - step: &install-twilio-flex-cli-plugin
      name: Install Twilio Flex CLI plugin
      script:
        - twilio plugins:install @twilio-labs/plugin-flex
        - twilio plugins
      caches:
        - twilio-cli
  - step: &install-dependencies
      name: Install dependencies
      script:
        - npm ci
      caches:
        - twilio-cli
        - npm
  - step: &build-and-deploy
      name: Build & Deploy
      script:
        - PACKAGE_VERSION=$(npm pkg get version | tr -d \") # Get the version from package.json. Here where I found the script: https://gist.github.com/DarrenN/8c6a5b969481725a4413?permalink_comment_id=4508378#gistcomment-4508378
        - PLUGIN_VERSION="${PACKAGE_VERSION}-${BITBUCKET_BUILD_NUMBER}" # Create a unique version for the plugin
        - PLUGIN_CHANGELOG="PLACEHOLDER"
        - twilio flex:plugins:deploy --version "$PLUGIN_VERSION" --changelog "$PLUGIN_CHANGELOG" --bypass-validation
      caches:
        - twilio-cli
        - npm

pipelines:
  # TODO: Right now, all the pipelines are custom ones because not all branches work with
  # Twilio CLI yet. When it's ready, we can switch to the pipelines that are triggered automatically
  custom:
    deployment-to-uat:
      - step: *install-twilio-flex-cli-plugin
      - step: *install-dependencies
      - step:
          <<: *build-and-deploy
          deployment: UAT

    deployment-to-prerelease:
      - step: *install-twilio-flex-cli-plugin
      - step: *install-dependencies
      - step:
          <<: *build-and-deploy
          deployment: Pre-Release
marek-siemieniuk-morawski commented 2 months ago

It didn't help to install the 7.0.1 version explicitly

steps:
  - step: &install-twilio-flex-cli-plugin
      name: Install Twilio Flex CLI plugin
      script:
        - twilio plugins:install @twilio-labs/plugin-flex@7.0.1
      caches:
        - twilio-cli
  - step: &install-dependencies
      name: Install dependencies
      script:
        - npm ci
      caches:
        - twilio-cli
        - npm

The logs say that the v7.0.1 was installed

Installing plugin @twilio-labs/plugin-flex... installed v7.0.1

it's still failing due to the same error

sanjeet-tw commented 1 month ago

Hi @marek-siemieniuk-morawski, It seems the environment has been corrupted. This flag is available in version 7, so it appears the installation of version 7 didn’t complete successfully. Could you please follow these steps in sequence to clean up the environment:

  1. Remove package-lock.json and node_modules
  2. Uninstall twilio-cli (via both npm and brew)
  3. Reinstall twilio-cli
  4. Install plugin-cli
marek-siemieniuk-morawski commented 1 month ago

Hey @sanjeet-tw , thanks for the response.

Don't know what changed, but the issue has gone itself. I didn't make any changes in the pipelines or package.json, and when I tried a day before yesterday, the build succeed.

We can close the issue