I was loading ACF with the keyed download link in a special composer package, but it sometimes required deleting the plugin to get it to update (which disrupted our nice reliable trellis deploys). acf-pro-installer works great, thanks @philippbaschke
Glad that you like it.
Hey guys,
Previously I was able to deploy without any issues but now I am getting the MissingKeyException error. I am able to use ACF Pro without any issues in the dev environment, the error only appears when I deploy to staging or production.
The acf_pro_key variable exists in each vault.yml file and successfully gets deployed to each remote environment in the .env file. I have re-provisioned the server but continue to get the error when I try to deploy.
Any help would be great
Unfortunately I never used Trellis so I canāt really help in that matter. I suspect that the problem occurs in the loadDotEnv
method. Maybe the .env
file is not in the current working directory (getcwd()
)?
Try to find out if the .env
file is loaded. If it is loaded you have to check the environment after it is loaded. getKeyFromEnv
should be the right place to do it
Hope that helps. Please let us know if you find out what the problem is (because you donāt seem to be the first one to have it)
I started getting this issue out of nowhere also, it does not let me deploy to remote servers. Did you happen to solve this?
EDIT: Fixed by removing ACF, running composer update, pushing to remote, then adding it back in.
Wouldnāt that mean that you would have to do this everytime you redeploy the site?
I just added the ACF Pro key to the site config in vault yml and I had to do this only once.
Iām trying to get composer to manage ACF Pro.
Hereās what I have:
Plus I have my key listed in my encrypted vault files.
When I run composer update
all appears to complete successfully but Iām not able to spot where ACF Pro was installed and it doesnāt show up in wp-admin plugins.
Perhaps Iām missing somethingā¦
You have "type": "library"
. That should be "type": "wordpress-plugin"
or "type": "wordpress-muplugin"
I had tried both types and none of them were working.
Turns out composer clear-cache
solved the problem.
Anyone had issues with acf-pro-installer on a Trellis box with multiple websites? Far as I can tell Iāve done everything right (like Iāve done on a dozen other sites) but it errors out trying to install.
If I run composer install
on the server it comes up āauthentication requiredā and asks for a username/password. The key is definitely there in the .env
file so no idea whatās wrongā¦
It installs fine on development, just not on production.
Edit: Actually this might just be itā¦
Hi,
I had originally just added ACF in as a plugin through the dashboard so Iāve set up all my custom fields etc. and have the custom fields in a JSON file stored in resources/acf-json. However I want to have it as a proper dependency in composer so that I donāt have to remember to copy it across when I deploy the site. When I copy all the ACF files across to the plugins folder then my custom fields are all there.
Iāve followed all of the above and have ACF installed in the vendor folder. Is this right? ACF isnāt showing in the list of plugins in the dashboard and nothing works until I manually copy the ACF files across to the plugins folder again.
My composer.json is:
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
},
{
"type": "package",
"package": {
"name": "advanced-custom-fields/advanced-custom-fields-pro",
"version": "5.6.10",
"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"
}
}
}
],
"require": {
"php": ">=5.6",
"composer/installers": "^1.4",
"vlucas/phpdotenv": "^2.0.1",
"johnpbloch/wordpress": "4.9.7",
"oscarotero/env": "^1.1.0",
"roots/wp-password-bcrypt": "1.0.0",
"johnbillion/extended-cpts": "^4.2",
"advanced-custom-fields/advanced-custom-fields-pro": "*",
},
I think Iāve twiddled and fiddled with everything so much that Iām not sure where everythingās being set any more.
Any help much appreciated.
Did you run composer update
after this? If so, did it say it was installing? Did it give an error?
Hi,
Yes I did and everything seemed fine.
Itās put all the files in the site/vendor folder and not in the web/app/themes/theme-name/vendor folder. Is that right? I know it will have done this because I edited the composer.json file in the site folder and not the theme folder. Everything seems to indicate the site composer file is the right place.
Sorry, canāt think straight!
Are you also using hirak/prestissimo
(global composer package) by chance?
There is a still open issue with hirak/prestissimo
and PhilippBaschke/acf-pro-installer
:
No, I donāt think so. How would I check this to be sure?
You can try to uninstall it:
$ composer global remove hirak/prestissimo
It is also possible to re-install it (but then the ACF installer wouldnāt work):
$ composer global require hirak/prestissimo
I tried to uninstall it but I donāt think it was installed. I get a runtime exception:
[RuntimeException]
Could not read ./composer.json
file_get_contents(./composer.json): failed to open stream: No such file or
directory
BTW I highly recommend adding fields by PHP includes in your theme. Much more reliable than JSON files. Iāve had instances where fields on development have been overwritten on deploy by outdated JSON files.
As an added benefit the fields canāt be edited in the Dashboard either.
Hi Simeon,
I agree. The main problem is that it doesnāt copy the ACF plugin files across at all so the site shows nothing until I copy those files across manually. Iād just love to be able to get it all working properly so that I know that I can always recreate the site no matter what happens and I wonāt have to remember various steps in the process.
Iāll look further into use PHP instead of JSON.
Thanks.