Search code examples
sqliteherokucomposer-phpshopify-app

Why does my deployment fail with an error about PHP's sqlite3 extension?


Trying to deploy a Shopify webapp using Heroku (following Shopify documentation) I am pushing from a branch (to test before merging into master) running git push heroku <branch name>:refs/head/main. This fails on step 10 of 15:

remote: Step 10/15 : RUN composer install
remote:  ---> Running in 6591d6b4b644
remote: Installing dependencies from lock file (including require-dev)
remote: Verifying lock file contents can be installed on current platform.
remote: Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
remote: Your lock file does not contain a compatible set of packages. Please run composer update.
remote:
remote:   Problem 1
remote:     - Root composer.json requires PHP extension ext-sqlite3 * but it is missing from your system. Install or enable PHP's sqlite3 extension.
remote:
remote: To enable extensions, verify that they are enabled in your .ini files:
  1. In PHP.ini I changed the extension directory to its location on my machine. I uncommented the line ";sqlite3" which caused issues, so I reverted this change.

  2. Composer update responds with:

    Nothing to modify in lock file

    and:

    Nothing to install, update, or remove

  3. I tried brew reinstall sqlite and have the most up-to-date version.

  4. My application uses MySQL (not SQLite), so I removed the SQLite requirement from composer.json. The app works on local hosting (Shopify), but I encounter the same error when I push the changes.

Is this related to Heroku, Docker containers, my code, or something else? My post in Shopify community and Heroku ticket haven't received answers.


Solution

    1. Manually remove the ext-sqlite3 dependency from your composer.json with a text editor

    2. Update your composer.lock lock-file with command composer update --lock

    3. Commit both file changes to your local git repository

      git add composer.json composer.lock
      git commit -m 'Remove SQLite3 PHP extension'
      
    4. Push your changes to the Heroku git remote

      git push heroku <branch name>