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

URL could not be accessed: HTTP/1.1 400 Bad Request #19

Open
strarsis opened this issue Aug 7, 2017 · 11 comments
Open

URL could not be accessed: HTTP/1.1 400 Bad Request #19

strarsis opened this issue Aug 7, 2017 · 11 comments

Comments

@strarsis
Copy link

strarsis commented Aug 7, 2017

I am suddenly unable to install/update ACF PRO:

$ composer update

- Installing advanced-custom-fields/advanced-custom-fields-pro (5.6.0): Downloading (connecting...)

  [Composer\Downloader\TransportException]
  The 'https://connect.advancedcustomfields.com/index.php?p=pro&a=download&t=5.6.0' URL could not be accessed: HTTP/1.1 400 Bad Request

composer.json:

[...]
  "repositories": [
    {
      "type": "composer",
      "url": "https://wpackagist.org"
    },{
      "type": "package",
      "package": {
        "name": "advanced-custom-fields/advanced-custom-fields-pro",
        "version": "5.6.0",
        "type": "wordpress-plugin",
        "dist": {
          "type": "zip",
          "url": "https://connect.advancedcustomfields.com/index.php?p=pro&a=download"
        },
        "require": {
          "philippbaschke/acf-pro-installer": "^1.0",
          "composer/installers": "^1.0"
        }
      }
    }
  ],
[...]

ACF PRO key is made available in .env:

ACF_PRO_KEY=<key>
[...]
@PhilippBaschke
Copy link
Owner

Thank you for your detailed report @strarsis ☺️

I tried reproducing your problem but your configuration works for me. However I realized something strange. When I use a wrong key in my .env file, the error message contains the k part of the URL as well:

[Composer\Downloader\TransportException]                                                                                                   
The 'https://connect.advancedcustomfields.com/index.php?p=pro&a=download&t=5.6.0&k=<bad key>' URL could not be accessed: HTTP/1.1 400 Bad Request

Can you try to run ACF_PRO_KEY=<key> composer update to rule out that the problem is your .env file?

@strarsis
Copy link
Author

strarsis commented Aug 7, 2017

Correct, I used some deliberately incorrect ACF_PRO_KEY and got the same error message.
So it may be a good idea to let this installer emit a notice/warning that the key is missing/unusual (length, pattern, etc).

@PhilippBaschke
Copy link
Owner

The key warning is a great idea! 🎉

But does your answer mean that it worked now or is it still failing? Can you test if your key contains URL characters that might be encoded (for example here)?

@strarsis
Copy link
Author

strarsis commented Aug 9, 2017

It works now. Apparently it was an issue with environment variables between WSL/Linux.

@partounian
Copy link

partounian commented Aug 10, 2017

I have also having this issue on my Mac machine. I'm using this with Trellis and haven't really changed anything to expect this issue. I checked the server and the pro key is still in the .env file, but it sems the ULR it tries downloading from does not append &k=[key].

EDIT: Fixed by removing ACF, running composer update, pushing to remote, then adding it back in.

@mickaelperrin
Copy link

I encountered this issue today and found it was a conflict with the plugin Hirak/prestissimo.

I have submitted a simple patch #20 to resolve it.

@maciekpaprocki
Copy link

Hi. I created temporary fork to fix my builds including @mickaelperrin fix. Feel free to use it.

I will archive it (not remove though as it would brake stuff) as soon as Phillip will come back.

@tomasruud
Copy link

I got this problem today as well, but it was because we had typed the wrong version number in the repository field.

@blakethomp
Copy link

blakethomp commented Jul 24, 2018

I got this problem today when running composer update advanced-custom-fields/advanced-custom-fields-pro, after updating the version #, however removing the package and requiring it again allowed it to install.

[Composer\Downloader\TransportException] The 'https://connect.advancedcustomfields.com/index.php?p=pro&a=download&t=5.7.1' URL could not be accessed: HTTP/1.1 400 Bad Request

@leovdw
Copy link

leovdw commented Nov 30, 2018

I had the same problem today, adding the two == at the end of the key fixed it

@markushausammann
Copy link

Same problem, none of the hacks here work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants