Missing composer packages when I deploy via FTP (wordmove)

Hi guys, me again…

I’m having a strange problem when I deploy my Sage sites - I’ve built assets with yarn and ran composer install --no-dev as mentioned in the docs, but something weird is happening - it seems like any composer packages I installed (well, at least acf-builder) seem to be missing, as none of my custom fields seem to be available…

is there another step I might be missing? I am using wordmove to deploy, and using the FTP method as my host has an annoying restriction on SCP, but I dont think this should really make a difference… should it?

I really want to fall in love with Sage as I love the development workflow/build tools and blade templating, but the deployment always seems to be causing me issues and I’m really not sure what it is that I’m missing!

Thanks in advance :slight_smile:

Edit: I should add that even though I am deploying via FTP, I do have access to cli on my host, if that makes any difference!

Edit#2: just to clarify the solution for anyone who comes across this after having the same problem, the cache folder is located inside the wp-content folder (using Acorn as a plugin and with a standard WP install), or in bedrock/web/app (not in theme/app) with a Bedrock install, as mentioned by @cim.

What files are you uploading?

Everything except node_modules, as advised by the docs!

I would love to use acf-composer as well but I’m forced to use a shared host.

However I remember getting it somewhat to work by uploading the cache files (in app/cache/acorn/) to the server. I am using acorn as a (normal) plugin.

Thanks for the tip - unfortunately there doesn’t seem to be a cache folder inside my app folder!

Have you looked in the vendor folder to see if the files there? (They probably are but it never hurts to check.)

My gut guess is this could be an issue with case (in)sensitivity across file systems, i.e. your local dev environment is case-insensitive (i.e. MacOS) and the remote is not (i.e. Linux). Composer autoloading will fail to load files if the file names don’t match, and some names will match on a case-insensitive file system, but fail to match on a case-sensitive file system. I’d check that the class names of your composers and their file names match and follow PSR-4. If you search the forums, there have also been a number of case sensitivity issues from users over the years.

Thanks for the tip - unfortunately there doesn’t seem to be a cache folder inside my app folder!

I should add that I use Bedrock and the cache folder is in bedrock/web/app (not in theme/app).

1 Like

Thanks! I’m using a standard WP install and the cache folder was in /wp-content - uploading this fixed my issue!

really appreciate you clarifying :slight_smile:

A cache folder shouldn’t need to be copied to the remote in order for the site to work—generally the contents of that folder that Sage/Acorn needs should be regenerated as needed. If for some reason they aren’t getting generated on your remote when you access the site, then you may run into problems in the future.

2 Likes

Yeah that makes sense - do you have any idea why this could be the case though? At the moment I’m just glad it’s finally working, but I can see how this could cause issues in the future.

My first guess would be permission issues; depending on the host (or just how you’ve configured it) they might restrict write access outside of certain directories (i.e. uploads). In theory you can change where Acorn stores that stuff (i.e. where the storage path is) but I’m not certain how. @QWp6t or @Log1x might be able to fill in the blanks there.

It could be a permission issue yes. In my case: I uploaded everything to the host myself, so permissions should be the same as any bedrock installation.

Other things you may verify to try to make acf-composer work on the remote host:

  • Make sure the postAutoloadDump function was added to the bedrock’s composer.json as stated in the docs
  • Make sure the license key for ACF pro was activated
  • upload all the vendor files

But in my case I still had to upload the cache files to make it work. And I agree with alwaysblank that that may lead to problems, so I gave up for the moment.

Another thing I was thinking: On my local machine when I ran

wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider"

I got this warning:

No publishable resources for tag [].
Publishing complete.

To fix this I had to run this:

$ wp acorn package:discover

$ wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider"

Cannot publish [/app/web/app/themes/mytheme/vendor/log1x/acf-composer/src/Providers/../../config/acf.php] until Acorn is initialized.

 Would you like to initialize Acorn right now? (yes/no) [yes]:
 > yes

Initialized [/app/web/app/themes/mytheme/config]
Copied File [/vendor/log1x/acf-composer/config/acf.php] To [/config/acf.php]
Publishing complete.

I was thinking maybe this is also preventing acf-composer to work on the remote host (where I cannot run these commands)