Custom plugin not functioning on deploy to staging

Hi folks,

Been scratching my head trying to figure this baby out for the past day, but alas, I have resulted - despite numerous searches high and low on this forum for a somewhat similar issue - in creating a topic for it.

Here’s my story.
Trellis, Bedrock, Sage setup :white_check_mark:

I have a custom plugin that fetches data from an API, and various Blade templates that call said functions and display the data in the template. I have included this plugin with my commits to Bitbucket (specifying that it should include this plugin when pushing to BB) as it is a private plugin.

So here’s the the deal – everything works fine on DigitalOcean - plugin functions well, data is being pulled, rendered , all that good stuff. The DO VPS I am pushing to is configured as production instance in Trellis, fwiw.

I go to configure my staging environment – which seems to go fine. It is a Rackspace server, only accessible via a VPN. The deploy also seems to go fine, my theme is working well, I import the database and we’re looking good.
However, when loading any page that uses my custom plugin, it hangs for 6 seconds or so, and eventually displays the basic WordPress content() but not a trace of my plugin’s API data. From looking at the logs from my site install in srv/www/mysite.com, I’m getting this:

[error] 8109#8109: 784 FastCGI sent in stderr: “PHP message: PHP Warning: usort() expects parameter 1 to be array, null given in /srv/www/—my-path-to-plugin-goes-here.php/ on line 62” while reading response header from upstream, client: 192.168.****, server: ..., request: “GET /category/my-custom-template/ HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm-wordpress.sock:”, host: “...", referrer: "http://..*.*/”

My question is — is there anything obvious about that error that I’m missing? My php-fpm-wordpress.sock is empty, but it’s almost empty on my working-fine DigitalOcean version.

Is the fact that my server, only accessible via a VPN, causing my API calls to falter?

What obvious reason that might be going over my head, is that such a similar setup would fail on my staging site, but function fine on a DO Droplet?

Any help is much appreciated.

If the Rackspace server is only accessible via VPN it might be blocking egress as well. If your plugin is getting data from a publicly available API, and Rackspace is blocking access to that API (and all other network traffic?) then that’ll cause it to fail.

This seems like a Rackspace networking problem, not a Roots problem.

The API is fairly straightforward, basic auth – but I am tempted to agree, surely the fact it works fine on a very similarly setup server over at DigitalOcean, then it’s something other than Roots/Sage related.

The fact the page load hangs for a number of seconds before rendering the normal content (note, not throwing an error or failing to load a page despite the API data not coming through) is normal behaviour?

Appreciate the rapid reply.

I don’t know enough about how your code is written to be sure whether the failure is normal, but if the site is trying, and trying, and trying, and ultimately failing to reach an outside resource, that could present as a hang.

That would make sense. I perhaps thought it may be a FastCGI buffer size problem, but when I looked at the same config over @ DO it’s the same, so I think I ruled that out at least.

My thoughts/hopes is that the VPN is causing the issue! I will consult with the system admin and see what happens.

Thanks Mike! :+1:t2:

1 Like

Just a follow up here. It was indeed an issue on Rackspace’s side re: firewall, and it’s all been cleared up.

1 Like