vercel-community / php

🐘 PHP Runtime for ▲ Vercel Serverless Functions (support 7.4-8.3)
https://php.vercel.app
MIT License
1.25k stars 290 forks source link

Composer validation always fails #352

Open asispts opened 1 year ago

asispts commented 1 year ago

Bug report

Description

When modify composer.json (e.q: add/remove a package), build process always fail to detect the change. The build process always use the same cache.

Installing Composer dependencies [START]
[8.0MiB/0.13s] Installing dependencies from lock file
[8.2MiB/0.13s] Verifying lock file contents can be installed on current platform.
[8.4MiB/0.13s] 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>`.
[9.8MiB/0.18s] Nothing to install, update or remove
[9.8MiB/0.18s] Generating optimized autoload files

Composer validation shows that composer.json is valid.

$ composer validate
./composer.json is valid

Solution

Redeploy without using existing build cache manually.

zhanang19 commented 1 year ago

Just want to share with anyone else. You can use ENV to skip using build cache.

See: https://vercel.com/docs/concepts/deployments/troubleshoot-a-build#managing-build-cache

f3l1x commented 1 year ago

Hi @asispts. Do you have composer.lock versioned in your project?

asispts commented 1 year ago

Hi @asispts. Do you have composer.lock versioned in your project?

Yes

f3l1x commented 1 year ago

So let me summarize this problem.

  1. Create project with composer.json + composer.lock + vercel.json + /api/index.php.
  2. Deploy to vercel.
  3. Modify composer.json + composer.lock (after calling composer update for example).
  4. Deploy to vercel.
  5. See -> 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>.

Right?

asispts commented 1 year ago

Yes, that's the steps to reproduce the issue. However, on the step 3, it's better to add a new package and use it in /api/index.php.