I'm doing a manual migration from a D7 site to a D8 site, and am using Migrate CSV Source to facilitate it. As such, I loaded all of the video URLs into the spreadsheet. I'm able to import all of the values into the field_my_embed_filed_value column and they show up in my nodes. However, shortly thereafter an error show up all over my site and causes some things to stop working.

Among other things, I cannot change the field formatter on my node display due to an ajax error and the following error:

"Fatal error: Call to a member function renderEmbedCode() on a non-object in /Users/mrweiner/Sites/devdesktop/jakesfireworks4-dev/docroot/modules/video_embed_field/src/Plugin/Field/FieldFormatter/Video.php on line 51".

Any Idea what's going on? I'm completely lost.

Comments

mrweiner created an issue. See original summary.

mrweiner’s picture

Title: After manual migration of embed field from d7 to d8, Fatal error: Call to a member function renderEmbedCode() on a non-object in » Fatal error: Call to a member function renderEmbedCode() on a non-object in /Users/mrweiner/Sites/devdesktop/jakesfireworks4-dev/docroot/modules/video_embed_field/src/Plugin/Field/FieldFormatter/Video.php on line 51
sam152’s picture

I wonder if there is an embed provider to match your input? What is the Video URL if you don't mind me asking?

sam152’s picture

Status: Active » Postponed (maintainer needs more info)
sam152’s picture

Can I nudge you on this? I'd like to look at making the module handle this better even if you've resolved the issue for your use case?

mrweiner’s picture

Thanks for the nudge. Got distracted with other aspects of development so I've just had the tables truncated to avoid the issue. I imported ~700 nodes, so there's not just a single URL that is/was the problem. However, I re-imported all of the Video URLs a bit ago and the error popped back up, so I started investigating the database. The urls are all either wistia or youtube urls, and I've got the wistia support module enabled, so all providers are supported.

It does look like a handful of the urls were malformed, though. The proper URL for the wistia videos is, let's say, https://myaccount.wistia.com/medias/xxxxxx. Some of the urls were formatted instead as:

I'm assuming that these must have been the problem entries. I just went through and remedied all of these manually, so I'm hoping that this knocks out the error. While the error hasn't come back yet, it's hard to say for sure if this solved it since it seemed to crop up randomly and then not go away until the tables were truncated.

I'll post an update back here when I (think I) know more.

mrweiner’s picture

Haven't had the error pop back up since updating those rows, so I'm hoping that that actually ended up taking care of it.

sam152’s picture

Title: Fatal error: Call to a member function renderEmbedCode() on a non-object in /Users/mrweiner/Sites/devdesktop/jakesfireworks4-dev/docroot/modules/video_embed_field/src/Plugin/Field/FieldFormatter/Video.php on line 51 » Fail gracefully when a video URL that has already been saved cannot be handled by an existing provider
mrweiner’s picture

It would be great if the failure could include a notice of which node(s) is/are the culprit(s).

sam152’s picture

Status: Postponed (maintainer needs more info) » Needs work
mirom’s picture

Status: Needs work » Needs review
StatusFileSize
new1.61 KB

Hi, I reached this problem as well in relation to migration.In my case I had to extract video resources from html and it's quite hard to normalise all of them. Attached patch is working fine for me.

sam152’s picture

Issue tags: +Needs tests

Thanks for working on this.

I wonder if this is sensitive to other contexts like the media entity integration and WYSWIYG embeds. The logging is interesting, although might fill up the logs. Perhaps a message in the output or something visual to indicate a video should be rendered but the value is invalid? In any case this would require some tests.

mirom’s picture

Status: Needs review » Needs work

I checked media and wysiwyg integrations and it seems to be covered there. I'll try to write some tests.

kasperg’s picture

I ended up in the same situation as other commenters in regard to migration. The patch in #11 works for me.

I could image you could end up in a similar situation if you use a module with a VideoEmbedProvider plugin, create some content which uses that provider and then uninstall the plugin.

In general Drupal\video_embed_field\Plugin\Field\FieldFormatter\Video calls \Drupal\video_embed_field\ProviderManagerInterface->loadProviderFromInput() but does not take the declared boolean return value into account. The patch in #11 fixes that.

sam152’s picture

Status: Needs work » Needs review
StatusFileSize
new6.14 KB

Added tests and displayed a message in the field output when providers were missing.

lpeabody’s picture

Should't this be a critical bug report given that a fatal error will kill the request?

sam152’s picture

Priority: Normal » Major

You can't really trigger this by installing the module and creating content, but it's probably the only open bug against 8.x so doesn't really matter what the priority is set to.

sam152’s picture

sam152’s picture

Status: Needs review » Fixed

  • Sam152 committed 4c3f973 on 8.x-1.x
    Issue #2828719 by Sam152, mirom, mrweiner, lpeabody, kasperg: Fail...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.