Open Mitiaj opened 2 months ago
Same issue here, but it's strange, with only one repository it works ok. When I add a second it fails. For example:
"repositories": {
"my-yoast": {
"type": "composer",
"url": "https://my.yoast.com/packages/"
},
"wpackagist": {
"type": "composer",
"url": "https://wpackagist.org"
}
}
It works correctly using composer CLI, but when running pack build reports the same parse error
Having a similar issue here, looks like it's having a problem with a "type: git" packages as well.
[Error: Failed to parse 'composer.lock']
There was an error parsing the lock file; it must be a valid
file generated by Composer and be in an up-to-date state.
Check below for any parse errors and address them if necessary.
The parsed contents were invalid.
Details: invalid value: string "git@gitlab.com:hpierce1102/ClassFinder.git", expected relative URL without a base at line 1243 column 9
Running composer validate
return no issues with the file, and using composer install
in local machine does work correctly.
Version used: heroku/builder:22
with heroku/php:0.1.2
The culprit is the url
crate, it cannot parse these URLs, see e.g. https://github.com/rust-lang/cargo/issues/12295 or https://github.com/rust-lang/cargo/issues/12404.
Best option is to parse as a string rather than a URL
@ngatti-tmm it should work when you make it an array of objects instead and drop the keys.
The reason is that otherwise, you do not get order guarantees, and order matters greatly for package lookup when Composer solves dependencies across repositories.
I'll see if there is a way to have a more ergonomic error message for exactly this case.
@ngatti-tmm it should work when you make it an array of objects instead and drop the keys.
Hi! thanks for the info, but I tried with
[
{
"type": "composer",
"url": "https://my.yoast.com/packages/"
},
{
"type": "composer",
"url": "https://wpackagist.org"
}
]
And it failed, but now with a strange composer.lock error:
===> BUILDING
Timer: Builder started at 2024-06-03T19:36:07Z
target distro name/version labels not found, reading /etc/os-release file
Running build for buildpack heroku/php@0.1.2
Looking up buildpack
Finding plan
Creating plan directory
Preparing paths
Running build command
Timer: Builder ran for 14.965122ms and ended at 2024-06-03T19:36:07Z
ERROR: failed to build: exit status 1
[Error: Failed to parse 'composer.lock']
There was an error parsing the lock file; it must be a valid
file generated by Composer and be in an up-to-date state.
Check below for any parse errors and address them if necessary.
The parsed contents were invalid.
Details: invalid value: string "git@github.com:Yoast-dist/wordpress-seo-premium.git", expected relative URL without a base at line 7060 column 9
But composer install
, validate
and update
they all work without any issues on other environments, also it worked with the older image.
Yup, now you're hitting the "real" issue described at the very top, @ngatti-tmm :)
Working on it!
As a workaround, you should be able to use ssh://git@github.com:22/Yoast-dist/wordpress-seo-premium.git
, @ngatti-tmm.
No workaround at this time for relative paths, though.
This is all valid composer repository annotations according to official composer documentation and it works in
heroku/buildpacks:20
. We have been migrating recently toheroku/builder:20/22
and we cant overcome this issue.Only first one with
https
is not producing crash.Build output log:
Another one: