Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer update: Undefined index: splits #890

Closed
wouterj opened this issue Apr 4, 2022 · 57 comments
Closed

composer update: Undefined index: splits #890

wouterj opened this issue Apr 4, 2022 · 57 comments

Comments

@wouterj
Copy link
Member

wouterj commented Apr 4, 2022

This error is caused by a very outdated Symfony Flex version. Please update it using this command:

composer update symfony/flex --no-plugins --no-scripts

Make sure it installs at least 1.17 (or higher). See https://symfony.com/blog/upgrade-flex-on-your-symfony-projects (from November 2021) for more information.

If you have installed Flex globally, run the command as composer global update instead of composer update to apply to the global plugin.

If you're using eZ Publish / Ibexa DXP

See this comment by @webhdx:

Upgrading to the latest Ibexa DXP release will fix the issue. Just remember to apply changes from ibexa/website-skeleton because we recently switched to serverless Flex approach.

If you're using Bolt CMS 4

See this comment by @bobdenotter:

I've tagged Bolt 4.2.6, which shouldn't block Flex 1.18 (or 2.x) anymore.

https://github.com/bolt/core/releases/tag/4.2.6

If you can't install Flex 1.17

Try seeing which dependency or constraint blocks you (and try submitting a fix in their repository), using:

composer why-not symfony/flex 1.18.0
@wouterj wouterj pinned this issue Apr 4, 2022
@lol768
Copy link

lol768 commented Apr 4, 2022

Can I ask why you thought it was acceptable to just break the old endpoint without clearly announcing a migration date? The blog posts I've read (and indeed read at the end of last year) just state an aspiration to move over at some point in the future.

We have not decided yet when we will shut down the current Flex server, but please upgrade at your earlier convenience to help us move forward faster.

All my CI jobs started failing today due to this, further exacerbated by the upgrade process being painful for those of us who've updated to PHP 8.1 in the meantime (not supported by laminas/laminas-code).

@stof
Copy link
Member

stof commented Apr 4, 2022

The need for updating to Flex 1.17+ was announced both in September 2021 and in November 2021 on the Symfony blog. and this was asked again multiple times on Twitter in the meantime.

@lol768
Copy link

lol768 commented Apr 4, 2022

Yes, vague warnings were posted on the blog and social media. Without any sort of "sunset date", deprecation timeline or actionable plan that communicated when the change needed to be made.

Come on, you absolutely can do better than that. All the Symfony core releases have a proper release lifecycle with documented, well-communicated EOL dates. When functionality is deprecated, the version number where it is deprecated and the version number for its scheduled removed is explicitly documented in your blog posts too.

@evertharmeling
Copy link

https://symfony.com/blog/upgrade-flex-on-your-symfony-projects advised to update ASAP.

We have not decided yet when we will shut down the current Flex server, but please upgrade at your earlier convenience to help us move forward faster.

That was 4 months ago, by just updating (running the mentioned command) you should be good.

@lol768
Copy link

lol768 commented Apr 4, 2022

"earliest convenience" and "we have not decided yet when we will shut down the current Flex server" != "ASAP" in my mind, at all.

by just updating (running the mentioned command) you should be good

As I mentioned, it's not quite that simple, I had to pin "laminas/laminas-code": "4.5.1" to get the updated Flex to install.

@Athov
Copy link

Athov commented Apr 4, 2022

We are on version 1.9.10 and it's getting the same error, the given solution is not working.

@evertharmeling
Copy link

We are on version 1.9.10 and it's getting the same error, the given solution is not working.

Try running composer why-not symfony/flex ^1.18

@Athov
Copy link

Athov commented Apr 4, 2022

We are on version 1.9.10 and it's getting the same error, the given solution is not working.

Try running composer why-not symfony/flex ^1.18

image

@evertharmeling
Copy link

evertharmeling commented Apr 4, 2022

composer update symfony/flex --no-plugins --no-scripts

There is your problem, you've pinned the version to "symfony/flex": "1.9.*", try changing it to at least "symfony/flex": "^1.9.0" (added the ^ in front of the version). And run the mentioned command again.

@attilajakab
Copy link

Is there a newsletter or some kind of channel where we can subscribe to for such critical / breaking updates? Please let me know.

@Athov
Copy link

Athov commented Apr 4, 2022

composer update symfony/flex --no-plugins --no-scripts

There is your problem, you've pinned the version to "symfony/flex": "1.9.*", try changing it to at least "symfony/flex": "^1.9.0" (added the ^ in front of the version). And run the mentioned command again.

Thank you this helped

@K4T
Copy link

K4T commented Apr 4, 2022

Unfortunately none of advice from that issue worked for me.

I simply did composer require symfony/flex and symfony/flex ^1.18 has been added to composer.json file. Now, when I execute composer install I am receiving Undefined index: splits error.

I am stuck, any ideas, please?

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Apr 4, 2022

@K4T You might have a global installation of flex.
Try running composer global update symfony/flex --no-plugins --no-scripts

@ishyevandro
Copy link

@wouterj thanks for creating an issue (i was lost debuging my vendor 😂 ) and showing the solution 🙏

@ghost
Copy link

ghost commented Apr 5, 2022

@nicolas-grekas
Something goes wrong with this endpoint https://flex.symfony.com/versions.json fetched by symfony/flex on composer install.
It takes more than 10 seconds to get the response with empty json. Therefore "splits" key does not exist in json response.
My application uses symfony/flex v1.15.1.

Upgrading to symfony/flex v1.18.5 fixes this issue for me => https://symfony.com/blog/upgrade-flex-on-your-symfony-projects

@stof
Copy link
Member

stof commented Apr 5, 2022

@sfi-fgarnier this is totally expected. The endpoint used by old Flex versions is being shutdown, as announced 6 months ago. That's why this pinned issue links to the blog post.

@MetalArend
Copy link

Why is symfony/flex calling out to a Flex endpoint during a composer install? The lock file (which in our case is restricting all packages to a nexus server) should be the SSOT, what is Flex even doing failing over some endpoint not being around on the internet?

martinberlin added a commit to martinberlin/cale-integrations that referenced this issue Apr 5, 2022
@fabpot
Copy link
Member

fabpot commented Apr 5, 2022

@MetalArend That's an issue that was fixed in the newest versions of Flex. So upgrading is the solution here.

@MetalArend
Copy link

@fabpot Aha, good to know. We've just updated. Thanks!

For some others coming here for the solution, make sure to run composer update symfony/flex --no-plugins --no-scripts with the extra flags, to not get stuck not being able to update because of the error that you're trying to solve. Not sure if this holds true for every later version of flex as well, but for us it did.

@smatyas
Copy link

smatyas commented Apr 5, 2022

I guess another problem for many projects will be that they still use php < 8.0, so they won't be able to upgrade for flex 2.x yet :/

@stof
Copy link
Member

stof commented Apr 5, 2022

@smatyas to solve the issue, upgrading to Flex 1.18+ is enough.

@smatyas
Copy link

smatyas commented Apr 5, 2022

@stof that will indeed solve the error message issue, but it makes silently install 5.x symfony/* deps for a 4.4 symfony project, which is even worse. We ended up setting those packages one-by-one with 4.4.* in the required block of the composer.json to mitigate the problem. That's what the extra.symfony.require - 4.4.* solved before, until the version.json was working, if I get it right.

I'm not saying it's a bad thing, this situation will make us upgrade those remaining projects finally :)

@stof
Copy link
Member

stof commented Apr 5, 2022

@smatyas if you run a full composer update with plugins disabled in a project that was relying on Flex to restrict Symfony to 4.4, this will indeed happen. But the instructions given in this issue and in the blog post are asking to do a partial update, upgrading only symfony/flex.

@emodric
Copy link
Contributor

emodric commented Apr 5, 2022

My symfony/flex package is on v2.1.6 and I still get this error on one of our projects.

composer update symfony/flex --no-plugins --no-scripts does not help since 2.1.6 is the latest version.

image

Any ideas? Should I just add flex://defaults?

My extra config is currently:

    "extra": {
        "symfony": {
            "allow-contrib": true,
            "endpoint": "https://flex.ibexa.co",
            "require": "5.4.*",
            "docker": false
        }
    }   

EDIT:

Adding flex://defaults didn't help, and it results in the following error:

image

@xserrat
Copy link

xserrat commented Apr 5, 2022

If it helps, I had the following error running composer update symfony/flex (I was in the version v1.14.4 )
image

And after running what @nicolas-grekas commented it worked well:
image

@webhdx
Copy link

webhdx commented Apr 5, 2022

@emodric In your case, upgrading to the latest Ibexa DXP release will fix the issue. Just remember to apply changes from ibexa/website-skeleton because we recently switched to serverless Flex approach.

@Lexus123
Copy link

Lexus123 commented Apr 5, 2022

I updated my symfony/flex to v1.13.4 since that's the highest I can upgrade to.

I keep getting this error even though I ran all the commands stated in this issue. When I run composer update symfony/flex --no-plugins --no-scripts my output says there is "nothing to install, update or remove" and that there's "nothing to modify in lock file".

Any guesses why the error keeps popping up?

@stof
Copy link
Member

stof commented Apr 5, 2022

@amine-betari I see that your folder is named ezplatform. Please look at the comment of @webhdx: #890 (comment) (Ibexa DXP is the new name of ezplatform)

@wouterj
Copy link
Member Author

wouterj commented Apr 5, 2022

Thanks for all the extra information - I've included some specialized troubleshooting info in the main description :)

@bobdenotter
Copy link

bobdenotter commented Apr 5, 2022

@Lexus123 I've tagged Bolt 4.2.6, which shouldn't block Flex 1.18 (or 2.x) anymore.

https://github.com/bolt/core/releases/tag/4.2.6

@NeilMasters
Copy link

Some people might need to wipe out their local flex dir before being able to update.

rm -rf vendor/symfony/flex && composer update symfony/flex

@cirovargas
Copy link

composer update symfony/flex not worked for me

#9 [build-deps 3/8] RUN APP_ENV=prod composer install --no-dev
#9 0.771 composer/package-versions-deprecated contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you consider it safe. See https://getcomposer.org/allow-plugins
#9 0.771 You can run "composer config --no-plugins allow-plugins.composer/package-versions-deprecated [true|false]" to enable it (true) or keep it disabled and suppress this warning (false)
#9 0.796 Installing dependencies from lock file
#9 0.810 Verifying lock file contents can be installed on current platform.
#9 11.11 
#9 11.11                            
#9 11.11   [ErrorException]         
#9 11.11   Undefined index: splits  
#9 11.11                            
#9 11.11 
#9 11.11 install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [-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>]...
#9 11.11 
#9 ERROR: executor failed running [/bin/sh -c APP_ENV=prod composer install --no-dev]: runc did not terminate sucessfully

Trying downgrade to flex 1.17,

Using symfony 6, PHP 7.4

@stof
Copy link
Member

stof commented Apr 5, 2022

composer update symfony/flex not worked for me

composer update symfony/flex is not the command you need to run to fix the issue. Please read again the description of this github issue for the full command to run. Options passed to it are important.

@cirovargas
Copy link

cirovargas commented Apr 5, 2022

composer update symfony/flex --no-plugins --no-scripts

Tried with options too, not solve

@stof
Copy link
Member

stof commented Apr 5, 2022

@cirovargas btw, your previous comment was showing an error happening during composer install, not during composer update.

@cirovargas
Copy link

@stof this is a prod env deploy, i run update on local (updated composer.lock) and submit to deploy

@cirovargas
Copy link

composer show symfony/flex

descrip. : Composer plugin for Symfony
keywords : 
versions : * v1.18.5
type     : composer-plugin
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : 
source   : [git] https://github.com/symfony/flex.git 10e438f53a972439675dc720706f0cd5c0ed94f1
dist     : [zip] https://api.github.com/repos/symfony/flex/zipball/10e438f53a972439675dc720706f0cd5c0ed94f1 10e438f53a972439675dc720706f0cd5c0ed94f1
path     : /var/www/html/vendor/symfony/flex
names    : symfony/flex

support
issues : https://github.com/symfony/flex/issues
source : https://github.com/symfony/flex/tree/v1.18.5

autoload
psr-4
Symfony\Flex\ => src

requires
composer-plugin-api ^1.0|^2.0
php >=7.1

requires (dev)
composer/composer ^1.0.2|^2.0
symfony/dotenv ^4.4|^5.0|^6.0
symfony/filesystem ^4.4|^5.0|^6.0
symfony/phpunit-bridge ^4.4.12|^5.0|^6.0
symfony/process ^4.4|^5.0|^6.0

@K4T
Copy link

K4T commented Apr 5, 2022

Some people might need to wipe out their local flex dir before being able to update.

rm -rf vendor/symfony/flex && composer update symfony/flex

And that was the last missing piece of the puzzle on my side... removing vendors.

@cirovargas
Copy link

Some people might need to wipe out their local flex dir before being able to update.
rm -rf vendor/symfony/flex && composer update symfony/flex

And that was the last missing piece of the puzzle on my side... removing vendors.

On my prod deploy i do a fresh install,
It seems that the problem only happens on composer install, not update

@nathansalter
Copy link

The need for updating to Flex 1.17+ was announced both in September 2021 and in November 2021 on the Symfony blog. and this was asked again multiple times on Twitter in the meantime.

I think a better migration path would have been to keep the existing server for a slightly longer period of time but make all the required files 404 so the error was actually at the correct location, maybe even with a static page at the 404 location linking to the blog post. This would have given a simple, easy to find solution. I don't think many people's first port of call is to check the Symfony blog when they get composer errors.

@fabpot
Copy link
Member

fabpot commented Apr 5, 2022

We've been displaying error messages for the last couple of months whenever you run composer update. Unfortunately, returning 404 would not help as Composer would just ignore the recipes and you would not have anything useful.
We've also made the server really slow at the same time (the 10 seconds delay) to try to get more feedback. As nobody complained, we thought that the traffic was mainly about bots and misconfigured CIs.
I have also posted tweets over and over again to alert people.
Unfortunately, there is nothing more I would have done (at least, we didn't find anything else we could do).

@wouterj
Copy link
Member Author

wouterj commented Apr 5, 2022

Apart from all the announcements and warnings that have been put in place, please note that 6 months have passed since the release of Symfony Flex 1.17. It is always a good idea to update your tooling more often than once a year (and as it's not production code, it's much more safe to do so).

@Anzurna
Copy link

Anzurna commented Apr 5, 2022

We had this issue even after updating symfony/flex.

In our case the problem was in gitlab runner configuration.
Cached "vendor" directory (with old version of symfony/flex) was preventing package from updating.

  cache:
    paths:
      - vendor/

@fearpro13
Copy link

fearpro13 commented Apr 5, 2022

We have issued same problem today, spent around 2 hours to get rid of this. The reason was very obvious, but found very late. We use gitlab ci-cd and configuration for it(.gitlab-ci.yml) had cache parameter that forced docker-container to use symfony/flex 1.12. Removing this parameter and changing required symfony/flex to ^1.18.5 in composer.json solved issues.

P.s read comment above

@colinodell
Copy link

To help with searchability, some affected users may see this error instead:

[ErrorException] Undefined index: manifests

@armageddon-cat
Copy link

armageddon-cat commented Apr 6, 2022

while trying to fix this issue, i've updated flex version. to 1.17 and to 1.18.5. both gives me new error:

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  Could not open input file: [./bin/console](https://bitbucket.org/../bin/console)
!!  
Script @auto-scripts was called via post-install-cmd

any ideas?

@SantinoPetrovic
Copy link

Updating flex version solved my issue with splits error. Thank you!

@ericmorand

This comment was marked as off-topic.

@fabpot
Copy link
Member

fabpot commented Apr 7, 2022

@ericmorand What do you mean? There is no breaking change here. Read the full story.

@kubk
Copy link

kubk commented Apr 7, 2022

I think the issue can be closed or limited to maintainers only. It is clear why it happened and what to do in order to fix it.

@ericmorand

This comment was marked as off-topic.

@symfony symfony locked as resolved and limited conversation to collaborators Apr 7, 2022
@fabpot fabpot closed this as completed Apr 15, 2022
@fabpot fabpot unpinned this issue May 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests