Using the ACF Pro official install method with Bedrock/Trellis

Bedrock

  • For development, use an auth.json file in the Bedrock project folder – but it should not be committed to the repository, but rather added to .gitignore as it is a secret (the ACF PRO license), similar to the .env file.
{
    "http-basic": {
+        "connect.advancedcustomfields.com": {
+            "username": "[ACF PRO license key]",
+            "password": "https://[domain.tld]"
+        }
    }
}

Use the ACF PRO license key as the username.

The password should be the site host (for which the license is active), including the protocol (https://example.com), not just the hostname or domain!
password must not be empty, it has to have some string value, and also it has to be a full URL with protocol, not just the hostname/domain, otherwise a HTTP authentication error will occur. Even if an Agency ACF PRO license is used with unlimited amount of sites, the password must be set to something (also see further below for setting a password to equal to each site host, which is needed for site-specific ACF PRO licenses).

  • Add the ACF PRO repository in composer.json:
  "repositories": [
+    {
+      "type":"composer",
+      "url":"https://connect.advancedcustomfields.com"
+    }
  ],
  • Require the ACF PRO plugin
    • Either by using the CLI:
      $ composer require wpengine/advanced-custom-fields-pro
    • Or by adding the require manually to composer.json (which the CLI command should do otherwise):
  "require": {
+  "wpengine/advanced-custom-fields-pro": "6.1.6"
  }
  • (Optional) Clean up previous mechanisms for installing ACF PRO, e.g.
  "repositories": [
-   {
-       "type": "package",
-       "package": {
-         "name": "advanced-custom-fields/advanced-custom-fields-pro",
-         "version": "6.1.6",
-         "type": "wordpress-plugin",
-         "dist": {
-           "type": "zip",
-           "url": "https://connect.advancedcustomfields.com/index.php?a=download&p=pro&k={%PLUGIN_ACF_KEY}&t={%version}"
-         },
-         "require": {
-           "composer/installers": "^2",
-           "ffraenz/private-composer-installer": "^5.0.0"
-         }
-       }
-     }
  ],
  "require": {
-  "advanced-custom-fields/advanced-custom-fields-pro": "6.1.6",
  }

But do not remove the alternative installer from allow-plugins yet,
as composer needs to have updated the dependencies once, before it can be removed without causing an error during deploy:

  "config": {
    "allow-plugins": {
      "ffraenz/private-composer-installer": true,
    }
}

This line can be cleaned up after a successful deploy:

  "config": {
    "allow-plugins": {
-      "ffraenz/private-composer-installer": true,
    }
}

Trellis

ACF PRO Agency license (unlimited sites) / global fallback

  • The same authentication data as in auth.json has to be added to group_vars/<environment>/vault.yml:
composer_authentications:
+   # Advanced Custom Fields (ACF) PRO plugin
+  - {
+       hostname: "connect.advancedcustomfields.com",
+       username: "[ACF PRO license key]",
+       password: "https://[site host (must be non-empty and a full URL with protocol)]"
+    }

ACF PRO site-specific licenses

Set the password for each site host in vault_wordpress_sites (also in group_vars/<environment>/vault.yml):

vault_wordpress_sites:
  example.com:
+    composer_authentications:
+      - {
+           hostname: "connect.advancedcustomfields.com",
+           username: "[ACF PRO license key (to which this site belongs)]",
+           password: "https://example.com" # host of site
+        }
  • (Optional) Clean up old variables used with the previous installation method:
    But only clean this variable up when the affected site uses this new installation method.
- plugin_acf_key: "..."
  • Deploy the Bedrock site, the ACF PRO plugin should be installed by Trellis using this new method.

Possible issues and workarounds

  • composer caches the packages, hence failing authentication may not be apparent until the cache was invalidated.

Possible improvements and remarks

As the ACF PRO Agency license allows for unlimited sites, it could make sense to add the ACF PRO license globally and set a different password with the host for each site. However, interpolation of a global ACF PRO license variable does not work as these are not templates. As this will work just fine when setting just one site as password for all other sites, this may not be important.

Resources

9 Likes

Follow up to this guide:

Besides installing ACF PRO natively using composer it can also be activated programmatically using a PHP constant:

For a Bedrock site this can be accomplished using an environment variable like ACF_PRO_LICENSE (set in .env standalone or in vault.yml in Trellis):

ACF_PRO_LICENSE='<ACF PRO key here>'
    ACF_PRO_LICENSE: '<ACF PRO key here>'

The environment variable can be set in the base config (as development.php) as PHP constant for being used by ACF PRO:

if (env('ACF_PRO_LICENSE')) {
    Config::define('ACF_PRO_LICENSE', env('ACF_PRO_LICENSE'));
}

That configuration code of Bedrock sites for setting PHP constants from environment variables is considerably growing with each newly added plugin that supports license keys/configuration from PHP constants like this.
It may be a good idea/time to add a standard library or some other mechanism to Bedrock that has a curated collection of these environment variables and PHP constants (and other variables initialized from environment variables).
I have to duplicate quite some code between existing and newly added Bedrock sites just for setting PHP constants and variables from environment variables.

3 Likes

This is a good idea. Do you want to open a feature request on the wp-config repo?

Edit: Adds new convenience methods by kellymears · Pull Request #3 · roots/wp-config · GitHub :eyes:

1 Like

I configured everything using the instructions above and the Trellis “Composer HTTP Basic Authentication” documentation and I keep getting

  In AuthHelper.php line 205:                                                                             
    The 'https://connect.advancedcustomfields.com/v2/plugins/composer_download?  
    p=pro&t=6.3.6' URL required authentication (HTTP 401).                       
    You must be using the interactive console to authenticate

in the hooks/build-after.yml “Install Composer dependencies” deployment step.

Does anyone have any tips on what I might be missing?

site/composer.json:

  "repositories": [
    {
      "type": "composer",
      "url": "https://composer.deliciousbrains.com",
      "only": ["deliciousbrains-plugin/*"]
    },
    {
      "type": "package",
      "package": {
        "name": "kinsta/kinsta-mu-plugins",
        "type": "wordpress-muplugin",
        "version": "2.3.3",
        "dist": {
          "url": "https://kinsta.com/kinsta-tools/kinsta-mu-plugins.zip",
          "type": "zip"
        }
      }
    },
    {
      "type": "composer",
      "url": "https://connect.advancedcustomfields.com"
    },
    {
      "type": "composer",
      "url": "https://wpackagist.org",
      "only": ["wpackagist-plugin/*", "wpackagist-theme/*"]
    }
  ],
  "require": {
        "wpengine/advanced-custom-fields-pro": "^6.3",

vault.yml:

  vault_wordpress_sites:
    sitename.org:
      composer_authentications:
        - {
          hostname: connect.advancedcustomfields.com,
          username: 123456789ABCDEFGHIKLMNOPQRSTUVWXYNabcdefghijklmnopqrstuvwxyz123456789012,
          password: https://sitename.org
        }
1 Like
  • sitename.org in vault_wordpress_sites matches the key of the wordpress site, correct?

This is where the site-specific composer authentication is set up by Trellis:

Also in build-after hook apparently:
https://github.com/roots/trellis/blob/a5040add97ac2befc1325eb13c80ee8c96d15dc5/roles/deploy/hooks/build-after.yml#L12-L24

Site-specific variable composer_authentications_using_basic_auth:
https://github.com/roots/trellis/blob/a5040add97ac2befc1325eb13c80ee8c96d15dc5/group_vars/all/helpers.yml#L25

1 Like

I don’t know how much the formatting matters, but my file has the hostname, username password all on one line instead of stacked.

composer_authentications:
      - { hostname: "connect.advancedcustomfields.com", username: "abcdef123456789", password: "https://mydomain.com" }
1 Like

Also, what composer version is used on the Trellis web server for installing the ACF PRO plugin, an older version may have issues or not support the auth (Composer doesn't use oauth/http-basic settings for private repos · Issue #8356 · composer/composer · GitHub).

1 Like

I believe this was the problem! Thank you so much for pointing me there. Unfortunately I closed the terminal window where I did the update, but I believe I was on composer 2.1.? before I updated to version 2.2.9.

@JordanC26, the inline formatting of the array item doesn’t seem to matter, thanks for your suggestion!

I should add that for this to work in my local development environment, I had to run composer config http-basic.connect.advancedcustomfields.com 123456789ABCDEFGHIKLMNOPQRSTUVWXYNabcdefghijklmnopqrstuvwxyz123456789012 https://live-url.org from my site/ folder.

2 Likes

For development, use an auth.json file.

Edit: What I also found useful is committing an auth.json.example to the repository which has a placeholder for the actual ACF PRO key. This helps with starting from a fresh workspace (other projects, and Bedrock do the same).

I’ve read through this thread multiple times but I still keep getting errors from advanced custom fields install. I would love some help on this, just recently got my vcs private plugins working and just trying to get this acf to work.

This is the exact error

Error: The 'https://connect.advancedcustomfields.com/v2/plugins/composer_download?s=composer&p=pro&t=6.3.12' URL required authentication.
You must be using the interactive console to authenticate

                                                                                                                                      
  [Composer\Downloader\TransportException]                                                                                            
  The 'https://connect.advancedcustomfields.com/v2/plugins/composer_download?s=composer&p=pro&t=6.3.12' URL required authentication.  
  You must be using the interactive console to authenticate   

This is my vault

# Documentation: https://roots.io/trellis/docs/vault/
vault_mysql_root_password: stagingpw

# Documentation: https://roots.io/trellis/docs/security/
vault_users:
  - name: "{{ admin_user }}"
    password: example_password
    salt: "generateme"

# Variables to accompany `group_vars/staging/wordpress_sites.yml`
# Note: the site name (`qa-scbc.acorninteractive.ca`) must match up with the site name in the above file.
vault_wordpress_sites:
  qa-scbc.redacted.ca:
    composer_authentications:
      - { hostname: "connect.advancedcustomfields.com", username: "redacted", password: "https://qa-scbc.redacted.ca" }
    env:
      ...

I am using github actions from roots radicle theme

name: Main

on:
  push:
    branches:
      - qa
  pull_request:
    branches:
      - qa
  workflow_dispatch:

jobs:
  php:
    name: PHP ${{ matrix.php }}
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, '[ci skip]')"
    strategy:
      matrix:
        php: ['8.2']

    steps:
      - name: Checkout the project
        uses: actions/checkout@v4

      - name: Setup the PHP ${{ matrix.php }} environment on ${{ runner.os }}
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php }}
          coverage: xdebug
          tools: composer:2.2.9
        env:
          GITHUB_TOKEN: ${{ secrets.COMPOSER_AUTH_TOKEN }}

      - name: Restore the Composer cache directory
        id: composercache
        run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

      - uses: actions/cache@v4
        with:
          path: ${{ steps.composercache.outputs.dir }}
          key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}-${{ secrets.COMPOSER_AUTH_TOKEN }}
          restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-

      - name: Install Composer dependencies
        run: composer install --optimize-autoloader --no-suggest -vvv

  node:
    name: Node ${{ matrix.node }}
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, '[ci skip]')"
    strategy:
      matrix:
        node: ['20']

    steps:
      - name: Checkout the project
        uses: actions/checkout@v4

      - name: Setup the Node ${{ matrix.node }} environment on ${{ runner.os }}
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
          cache: 'yarn'
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Install dependencies using Yarn
        run: yarn install --frozen-lockfile

      - name: Build and compile assets
        run: |
          yarn build
          cat public/dist/entrypoints.json
          cat public/dist/manifest.json
          cat public/dist/theme.json

And my composer.json

{
    "name": "roots/bedrock",
    "type": "project",
    "license": "MIT",
    "description": "WordPress boilerplate with Composer, easier configuration, and an improved folder structure",
    "homepage": "https://roots.io/bedrock/",
    "authors": [
        {
            "name": "Scott Walkinshaw",
            "email": "scott.walkinshaw@gmail.com",
            "homepage": "https://github.com/swalkinshaw"
        },
        {
            "name": "Ben Word",
            "email": "ben@benword.com",
            "homepage": "https://github.com/retlehs"
        }
    ],
    "keywords": [
        "bedrock",
        "composer",
        "roots",
        "wordpress",
        "wp",
        "wp-config"
    ],
    "support": {
        "issues": "https://github.com/roots/bedrock/issues",
        "forum": "https://discourse.roots.io/category/bedrock"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/andersai/wp-all-import-pro.git"
        },
        {
            "type": "vcs",
            "url": "https://github.com/andersai/gravity-forms.git"
        },
        {
            "type": "vcs",
            "url": "https://github.com/andersai/ajax-search-pro.git"
        },
        {
            "type": "composer",
            "url": "https://wpackagist.org",
            "only": [
                "wpackagist-plugin/*",
                "wpackagist-theme/*"
            ]
        },
        {
            "type": "composer",
            "url": "https://connect.advancedcustomfields.com"
        }
    ],
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "files": [
            "app/helpers.php"
        ]
    },
    "require": {
        "php": ">=8.2",
        "blade-ui-kit/blade-heroicons": "^2.2",
        "blade-ui-kit/blade-icons": "^1.5",
        "composer/installers": "^2.2",
        "guzzlehttp/guzzle": "^7.5",
        "johnbillion/extended-cpts": "^5.0",
        "log1x/acorn-disable-media-pages": "^1.0",
        "masterminds/html5": "^2.8",
        "oscarotero/env": "^2.1",
        "roots/acorn": "^4.0",
        "roots/acorn-prettify": "^1.0",
        "roots/bedrock-autoloader": "^1.0",
        "roots/bedrock-disallow-indexing": "^2.0",
        "roots/wordpress": "6.7.2",
        "roots/wp-config": "1.0.0",
        "roots/wp-password-bcrypt": "1.1.0",
        "roots/wp-stage-switcher": "^2.2",
        "vlucas/phpdotenv": "^5.5",
        "wpackagist-plugin/acf-quickedit-fields": "^3.3",
        "wpackagist-plugin/admin-menu-editor": "^1.12",
        "wpackagist-plugin/advanced-query-loop": "^4.0",
        "wpackagist-plugin/amazon-s3-and-cloudfront": "^3.2",
        "wpackagist-plugin/autodescription": "^5.1",
        "wpackagist-plugin/block-enhancements": "^1.2",
        "wpackagist-plugin/block-options": "^1.40",
        "wpackagist-plugin/check-email": "^2.0",
        "wpackagist-plugin/classic-editor": "^1.6",
        "wpackagist-plugin/custom-post-type-ui": "^1.16",
        "wpackagist-plugin/ewww-image-optimizer": "^8.1",
        "wpackagist-plugin/feedbucket": "^1.0",
        "wpackagist-plugin/insta-gallery": "^4.6",
        "wpackagist-plugin/lh-archived-post-status": "^3.11",
        "wpackagist-plugin/media-cleaner": "^6.7",
        "wpackagist-plugin/password-protected": "^2.7",
        "wpackagist-plugin/query-monitor": "^3.17",
        "wpackagist-plugin/safe-svg": "^2.1",
        "wpackagist-plugin/templets": "^0.2.0",
        "wpackagist-plugin/w3-total-cache": "^2.8",
        "wpackagist-plugin/wordpress-importer": "^0.8.2",
        "wpackagist-plugin/wp-google-maps": "^9.0",
        "wpackagist-plugin/wp-mail-smtp": "^4.3",
        "wpackagist-plugin/wp-newrelic": "^1.3",
        "wpackagist-plugin/wp-webhooks": "^3.3",
        "wpengine/advanced-custom-fields-pro": "^6.0",
        "andersai/wp-all-import-pro": "4.10.0",
        "andersai/gravity-forms": "2.9.4",
        "andersai/ajax-search-pro": "1.0.0"
    },
    "require-dev": {
        "johnbillion/query-monitor": "^3.12",
        "laravel/pint": "^1.4",
        "pestphp/pest": "^2.0",
        "phpcompatibility/php-compatibility": "^9.3",
        "roave/security-advisories": "dev-latest",
        "spatie/laravel-ignition": "^2.4"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "allow-plugins": {
            "composer/installers": true,
            "roots/wordpress-core-installer": true,
            "pestphp/pest-plugin": true,
            "ffraenz/private-composer-installer": true
        },
        "sort-packages": true,
        "platform": {
            "php": "8.2.18"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "extra": {
        "acorn": {
            "providers": [
                "App\\Providers\\AssetsServiceProvider",
                "App\\Providers\\BlocksServiceProvider",
                "App\\Providers\\ThemeServiceProvider",
                "App\\Providers\\PostTypesServiceProvider"
            ]
        },
        "installer-paths": {
            "public/content/mu-plugins/{$name}/": [
                "type:wordpress-muplugin"
            ],
            "public/content/plugins/{$name}/": [
                "type:wordpress-plugin"
            ],
            "public/content/themes/{$name}/": [
                "type:wordpress-theme"
            ]
        },
        "wordpress-install-dir": "public/wp"
    },
    "scripts": {
        "lint": "pint --test",
        "lint:fix": "pint",
        "test": "pest",
        "post-autoload-dump": [
            "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
        ]
    }
}

This appears to be a previously discussed error:

Ok I had read through that thread as well, and it doesn’t seem to have a resolution or one that I could pinpoint, is there something I am missing? I really appreciate the response. Because I set my composer to tools: composer:2.2.9 as mentioned by @tboggia which referenced that thread.

This ended up working for my pipeline

env:
    COMPOSER_AUTH_JSON: |
      {
        "http-basic": {
          "connect.advancedcustomfields.com": {
            "username": "${{ secrets.acf_username }}",
            "password": "${{ secrets.acf_password }}"
          }
        }
      }

This documentation really helped

For I was using

https://github.com/shivammathur/setup-php

In my github action

2 Likes

:thinking: Interesting, so I think I understand then that the GitHub actions need this format to interpolate the ACF PRO username + password.

Hmm now my deploy step action is failing on composer install with trellis and not sure why. It uses the same PAT as the other github action I posted above that passed. Basically my deploy step fails

name: Deploy SCBC site to QA

on:
  workflow_dispatch:
  push:
    branches: [qa]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '20'
          cache: yarn
          cache-dependency-path: yarn.lock
      - uses: shimataro/ssh-key-action@v2
        with:
          key: ${{ secrets.TRELLIS_DEPLOY_SSH_PRIVATE_KEY }}
          known_hosts: ${{ secrets.TRELLIS_DEPLOY_SSH_KNOWN_HOSTS }}
      - uses: webfactory/ssh-agent@v0.5.4
        with:
          ssh-private-key: ${{ secrets.TRELLIS_DEPLOY_SSH_PRIVATE_KEY }}
      - uses: roots/setup-trellis-cli@main
        with:
          ansible-vault-password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
          repo-token: ${{ secrets.COMPOSER_AUTH_TOKEN }}
      - name: Deploy
        run: cd trellis && trellis deploy qa 
fatal: [5.78.97.124]: FAILED! => {"changed": false, "msg": "Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Package operations: 31 installs, 7 updates, 0 removals - Downloading andersai/ajax-search-pro (1.0.0) - Downloading andersai/gravity-forms (2.9.4) - Downloading andersai/wp-all-import-pro (4.10.0) - Downloading wpengine/advanced-custom-fields-pro (6.3.12) Failed to download andersai/ajax-search-pro from dist: The \"https://api.github.com/repos/andersai/ajax-search-pro/zipball/33b78248b43b5253f01f3577b2c6962393263f05\" file could not be downloaded (HTTP/2 404 ): {\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"} Now trying to download from source - Syncing andersai/ajax-search-pro (1.0.0) into cache Failed to download andersai/wp-all-import-pro from dist: The \"https://api.github.com/repos/andersai/wp-all-import-pro/zipball/5b9407546ab9d1899b3579eb894712fbcb4c9470\" file could not be downloaded (HTTP/2 404 ): {\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"} Now trying to download from source - Syncing andersai/wp-all-import-pro (4.10.0) into cache Failed to download andersai/gravity-forms from dist: The \"https://api.github.com/repos/andersai/gravity-forms/zipball/4139f8d0f215bbd8d0fdf25a7ffda2177a792a4f\" file could not be downloaded (HTTP/2 404 ): {\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"} Now trying to download from source - Syncing andersai/gravity-forms (2.9.4) into cache In AuthHelper.php line 205: The 'https://connect.advancedcustomfields.com/v2/plugins/composer_download? s=composer&p=pro&t=6.3.12' URL required authentication (HTTP 401). You must be using the interactive console to authenticate install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]", "stdout": "Installing dependencies from lock file\nVerifying lock file contents can be installed on current platform.\nPackage operations: 31 installs, 7 updates, 0 removals\n  - Downloading andersai/ajax-search-pro (1.0.0)\n  - Downloading andersai/gravity-forms (2.9.4)\n  - Downloading andersai/wp-all-import-pro (4.10.0)\n  - Downloading wpengine/advanced-custom-fields-pro (6.3.12)\n    Failed to download andersai/ajax-search-pro from dist: The \"https://api.github.com/repos/andersai/ajax-search-pro/zipball/33b78248b43b5253f01f3577b2c6962393263f05\" file could not be downloaded (HTTP/2 404 ):\n{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"}\n    Now trying to download from source\n  - Syncing andersai/ajax-search-pro (1.0.0) into cache\n    Failed to download andersai/wp-all-import-pro from dist: The \"https://api.github.com/repos/andersai/wp-all-import-pro/zipball/5b9407546ab9d1899b3579eb894712fbcb4c9470\" file could not be downloaded (HTTP/2 404 ):\n{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"}\n    Now trying to download from source\n  - Syncing andersai/wp-all-import-pro (4.10.0) into cache\n    Failed to download andersai/gravity-forms from dist: The \"https://api.github.com/repos/andersai/gravity-forms/zipball/4139f8d0f215bbd8d0fdf25a7ffda2177a792a4f\" file could not be downloaded (HTTP/2 404 ):\n{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"}\n    Now trying to download from source\n  - Syncing andersai/gravity-forms (2.9.4) into cache\n\nIn AuthHelper.php line 205:\n                                                                               \n  The 'https://connect.advancedcustomfields.com/v2/plugins/composer_download?  \n  s=composer&p=pro&t=6.3.12' URL required authentication (HTTP 401).           \n  You must be using the interactive console to authenticate                    \n                                                                               \n\ninstall [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]\n\n", "stdout_lines": ["Installing dependencies from lock file", "Verifying lock file contents can be installed on current platform.", "Package operations: 31 installs, 7 updates, 0 removals", "  - Downloading andersai/ajax-search-pro (1.0.0)", "  - Downloading andersai/gravity-forms (2.9.4)", "  - Downloading andersai/wp-all-import-pro (4.10.0)", "  - Downloading wpengine/advanced-custom-fields-pro (6.3.12)", "    Failed to download andersai/ajax-search-pro from dist: The \"https://api.github.com/repos/andersai/ajax-search-pro/zipball/33b78248b43b5253f01f3577b2c6962393263f05\" file could not be downloaded (HTTP/2 404 ):", "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"}", "    Now trying to download from source", "  - Syncing andersai/ajax-search-pro (1.0.0) into cache", "    Failed to download andersai/wp-all-import-pro from dist: The \"https://api.github.com/repos/andersai/wp-all-import-pro/zipball/5b9407546ab9d1899b3579eb894712fbcb4c9470\" file could not be downloaded (HTTP/2 404 ):", "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"}", "    Now trying to download from source", "  - Syncing andersai/wp-all-import-pro (4.10.0) into cache", "    Failed to download andersai/gravity-forms from dist: The \"https://api.github.com/repos/andersai/gravity-forms/zipball/4139f8d0f215bbd8d0fdf25a7ffda2177a792a4f\" file could not be downloaded (HTTP/2 404 ):", "{\"message\":\"Not Found\",\"documentation_url\":\"https://docs.github.com/rest/repos/contents#download-a-repository-archive-zip\",\"status\":\"404\"}", "    Now trying to download from source", "  - Syncing andersai/gravity-forms (2.9.4) into cache", "", "In AuthHelper.php line 205:", "                                                                               ", "  The 'https://connect.advancedcustomfields.com/v2/plugins/composer_download?  ", "  s=composer&p=pro&t=6.3.12' URL required authentication (HTTP 401).           ", "  You must be using the interactive console to authenticate                    ", "                                                                               ", "", "install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--]

The composer_auth_token is a repo wide read access PAT token

I have also changed from

{
            "type": "vcs",
            "url": "https://github.com/andersai/gravity-forms.git"
        },

to

{
            "type": "vcs",
            "url": "git@github.com:andersai/gravity-forms.git"
        },

as per trellis docs for private composer pacakges

Turns out in all the changes I had made I had done the one thing that would cause this which is removing this from the vault. Oh my that was dumb. Because I was only trying to get the first action to pass and had removed this because it didn’t help the first but I needed both setups for both to pass

composer_authentications:
      - { hostname: connect.advancedcustomfields.com, username: redacted, password: https://qa-scbc.redacted.ca }
      - { hostname: github.com, username: redacted }
2 Likes