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

Not rendering after moving files & db to new server #29

Closed
wfendler opened this issue Sep 10, 2016 · 5 comments
Closed

Not rendering after moving files & db to new server #29

wfendler opened this issue Sep 10, 2016 · 5 comments
Labels

Comments

@wfendler
Copy link

First - thanks for the plugin! This will be a lifesaver on my current project. Lots of different embeds throughout the blog especially.

The problem I'm encountering:
I moved my asset folders from my local site to my staging server and imported the database. They show up in the asset library and on the entries I've added them to in the CP but the template doesn't render any of them and I get this error:

Impossible to access an attribute ("html") on a null variable

Local and remote are both PHP 7 and Craft CMS 2.6.2931

@benjamminf
Copy link
Contributor

benjamminf commented Sep 11, 2016

Hey @wfendler, this is a common problem and one that depends entirely on how the server is configured. If you haven't already, upgrade to EA 0.3.4 which was released yesterday. This (finally) adds logging to the plugin which I can use to help diagnose the problem.

This behaviour indicates that the embedded asset JSON file can't be read for some reason, so craft.embeddedAsset.fromAsset(asset) is returning null. What that reason is really depends on your PHP and server configs. With 0.3.4 installed, try rendering one of your templates, then find the file craft/storage/runtime/logs/embeddedassets.log and upload it here, or send it to me (benf) on Craft's Slack channel. Or you can go through the log yourself and see if you spot any errors.

@benjamminf benjamminf added the bug label Sep 11, 2016
@wfendler
Copy link
Author

wfendler commented Sep 12, 2016

Cool, looks like I've been using 0.3.4 the whole time. So I've got some logs but it looks like the only thing being logged is a bunch of [info] [plugin] Reading file with curl. I'll send it over on Slack though in case I'm missing anything.

@wfendler
Copy link
Author

wfendler commented Sep 12, 2016

Just tried adding a new embed on the server and that's not working either. So the transfer of data isn't what went wrong. There's something up with the server environment. Anything come to mind that I should check into first?

Asset folder has 755 permissions. The json files inside of that are 664.

When I look at the embed assets in the CP it's getting all of the titles right. So it must be reading those json files (although the thumbnail images are missing for the ones I've moved over).

I'm using ServerPilot + Digital Ocean.

Here's my basic server info from Craft:
screen shot 2016-09-12 at 11 30 53 am

Let me know if any of the php info would be helpful. Too long to upload. For now I'll continue to do some poking around to see what I can come up with. Thanks for any help!

@leevigraham
Copy link
Contributor

leevigraham commented Sep 29, 2016

When I look at the embed assets in the CP it's getting all of the titles right. So it must be reading those json files (although the thumbnail images are missing for the ones I've moved over).

Pretty sure titles are being pulled from the DB not from the json

@awcross
Copy link
Contributor

awcross commented Oct 7, 2016

After looking into this, I found the problem to be that the site url and server_name variables are different due to the fact I'm running Vagrant with port forwarding.

Basically, the readAssetFile method is grabbing the site url localhost:8080 instead of the server_name set to localhost. Because of that, curl can't find the file on the server.

Is it possible to use craft()->request->getServerName() instead or fallback in some way?

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

No branches or pull requests

4 participants