ACF Custom Blocks not recognized on production

Hi all!

First of all, I’m not sure where to post this (as I don’t know if this is a sage, acorn, acf-builder or acf-composer issue - or something completely different). So I’ll try my luck here first.

I’m currently facing a strange problem. Besides Bedrock/Sage 10 (5.0.0-next.18, acorn 2.0.0-beta.5) I’m using AcfBuilder v1.12.0 and AcfComposer v2.0.3 (+ Advanced Custom Fields PRO 5.11.4). Due to be bound to Apache I am not using Trellis.
I don’t have any custom post types so far and I don’t use ACF for “plain” custom fields, just for custom blocks generated by AcfBuilder/AcfComposer.

This setup is running pretty well on both of my 2 (slightly different) local boxes.

However, the custom blocks/fields aren’t recognized on staging and production (in other words: they’re not editable from the WP backend). I can sync databases forth and back and the content/output keeps staying correct - the only thing is, the custom blocks don’t seem to be recognized on both remote servers.

Any ideas about this? What am I possibly missing? I really feel a bit stupid about this, any suggestions/hints welcome.

Have you activated the license key for ACF pro on your remote machines?

@schilke-ts something similar is happening to me.

I am using Acorn 2.0.6 and I have a few custom plugins using ACF Composer.

Installing Acorn through the Composer’s theme it works fine. When I try to installing it through the Bedrock Composer, Blocks in the custom plugins are not fired anymore.

I am investigating since few days, unfortunately without success yet.

Did you also add the postAutoloadDump function to the bedrock’s composer.json:

"post-autoload-dump": [
  "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
]

as stated in the docs?

Yes I did @Twansparant

The only times I had these kind of problems, is with case sensitive folder names and psr-4 autoloading, so locally these files would load:

app/blocks/**

but didn’t on staging/production.
These would load in every environment:

app/Blocks/**

Could that be the case for you?

@alwaysblank Um, yes, but is the activated ACF Pro license key mandatory to make it work at all? AFAIK this only affects updates - did they make any changes to this? (I believe this would bring them instantly into trouble with the GPL :grimacing: )

@Twansparant Oh, I guess that’s new? At least I didn’t need to do so before. I am not an acorn or Laravel expert - but I’m not sure if this could help in my situation as I’m just transferring all necessary files from local to remote directly and don’t use wp-cli or acorn directly on remote - but I’ll have a look. Thanks for suggesting!

Yup, I think I’m safe there (I’ve read quite a lot about this problem in other situations). But thanks!

So are you literally copying all of your composer vendor files to production? That’s probably the problem… Do you have SSH acces to your remote server? Try running composer install instead in your remote bedrock & theme folder.

1 Like

Yes - I do have SSH access but the reason I am doing this is because the hoster on this project is a security fanatic and practically nothing of the environment is standard. The docs state that this shouldn’t be a problem but I’m probably missing something?

No you’re right, that shouldn’t be a problem, but that’s just the Sage part. Acorn is installed in the bedrock directory right?

Can you try running an acorn command on your remote server:

wp acorn package:discover
1 Like

I tried to use acf -composer on a shared host. I have ssh access, but can’t install vendor dependencies with composer. So I also copied vendor files to production. Encountered the same problems as you. Then I thought I got it to work by rsyncing the web/app/cache/acorn folder to the server. I started to get errors though (don’t remember which) so I gave up for the moment.
edit: using acorn as a plugin by the way

My bad :man_facepalming: now we’re getting somewhere… Yes, I didn’t install acorn as a plugin and due to the aforementioned problems the hoster’s admin did the complete bedrock install for me. But a quick check shows that the contents of vendor differ quite a lot. So I’m going to check this in detail (and the hoster probably has to fix this). Thanks for now!

1 Like