I was trying to debug an issue like #1842842: Best way to get/update the lastet dev release? with the error message

EntityMetadataWrapperException: Unknown data property field_target_nodes. in EntityStructureWrapper->getPropertyInfo()

After a while I realized that the message types "commons_notify_comment_created", "commons_notify_node_created" and "commons_notify_node_created_no_groups" didn't contain any fields anymore except "metatags". (see attachment)
Fields like "field_target_nodes", "field_target_comments", "field_message_rendered_subject", "field_message_rendered_body" are missing.
However, the status is show as "Default" for all of them. Changing and then reverting them didn't restore the fields, so I had to recreate them manually.
I tried to update from beta2 to the latest dev and recreated the message type, but also without any luck.

The issue didn't appear on a fresh install. On the affected install the message types have not been modified before the issue appeared. I'm not sure what was causing this problem or if the fields will get deleted again even after creating them manually.

Comments

thomas.feichter’s picture

Sorry, copied the wrong issue id. Here the correct one:
#1913702: Target field_target_nodes missing from 'node created' message

jpontani’s picture

Status: Active » Postponed (maintainer needs more info)

There must have been an issue with your existing install prior to updating. Currently, there is no upgrade path from any beta to dev releases, as such, any field definitions that have been added to dev aren't guaranteed to be installed properly. Features do not automatically update upon upgrading, you will have to manually revert features to their code definitions.

thomas.feichter’s picture

Version: » 7.x-3.0-beta2
Priority: Critical » Normal
Status: Postponed (maintainer needs more info) » Active

That is correct, the issue appeared in beta2. As reverting the message types in beta2 didn't help, I tried to update to the latest dev version.
Yesterday I just tried to restore the message types but didn't think about restoring commons_notify feature (it was too late at night probably). Did that now (in beta2) and it restored the message fields.
Still not sure though what caused the feature to be overwritten in the first place, as the message types have not been modified before the issue appeared.
I'll try to reproduce the problem.

I changed the issue version to beta2, that's more accurate and priority to normal as there is an easy workaround (if the feature has not been customized).

ezra-g’s picture

I tried to update to the latest dev version.
Yesterday I just tried to restore the message types but didn't think about restoring commons_notify feature

One change between beta2 and the latest dev related to field exports is that we updated the patch to Features module for #1064472: separate fields from field instances.

@thomas.feichter - It would be very helpful if you could test an upgrade between beta2 and the latest dev, reverting all feature modules after updating the codebase. You can use the drush features-revert-all command to help make this task faster.

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)
thomas.feichter’s picture

Status: Postponed (maintainer needs more info) » Active

I did now the following workflow:

- Updated "broken" beta2 to dev version from yesterday
- Tested commenting, which resulted in a PHP error
- Reverted all features with drush:

# drush features-revert-all
The following modules will be reverted: commons_events, commons_like, commons_search, commons_search_core, commons_notify, commons_wikis, commons_polls, commons_site_homepage, commons_misc
Do you really want to continue? (y/n): y
Reverted menu_links.   [ok]
Do you really want to revert menu_links? (y/n): y
Reverted variable.  [ok]
Do you really want to revert variable? (y/n): y
Reverted menu_links.  [ok]
Do you really want to revert menu_links? (y/n): y
Reverted page_manager_handlers.  [ok]
Do you really want to revert page_manager_handlers? (y/n): y
Reverted message_type. [ok]
Do you really want to revert message_type? (y/n): y
Reverted variable. [ok]
Do you really want to revert variable? (y/n): y
Reverted variable. [ok]
Do you really want to revert variable? (y/n): y
Reverted page_manager_pages. [ok]
Do you really want to revert page_manager_pages? (y/n): y
Reverted variable. [ok]
Reverted page_manager_handlers.  [ok]
Do you really want to revert variable? (y/n): y
Do you really want to revert page_manager_handlers? (y/n): y

- Tested commenting, which still resulted in a PHP error
- Checked features and message types and realized that all features except commons_notify have been reverted.
- Tried to revert the feature commons_notify manually, but also that didn't work out even though i get the notification: "Reverted all message_type components for commons_notify."

Reverting commons_notify in beta2 was working without problems.

jpontani’s picture

What does the Override tab say for Commons Notify? What is overridden?

ezra-g’s picture

- Tested commenting, which still resulted in a PHP error

Can you specify the PHP error?

ezra-g’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)
thomas.feichter’s picture

@jpontani
It is still overridden (see attachment)

@ezra-g
If I create a comment or a node I get the same error as mentioned above:

EntityMetadataWrapperException: Unknown data property field_target_nodes. in EntityStructureWrapper->getPropertyInfo() (line 339 of /[...]/profiles/commons/modules/contrib/entity/includes/entity.wrapper.inc).

Because field_target_nodes is being accessed in the functions commons_notify_node_insert and commons_notify_comment_insert without checking if it actually exists.
A small workaround to make this issue less critical could be to check if the field exists and if not simply skip it and eventually log it to ease debugging in case the fields are missing. That would't cause the commenting and node creation functionality to break if there is any issue with the message fields.

thomas.feichter’s picture

Status: Postponed (maintainer needs more info) » Active
ezra-g’s picture

Status: Active » Closed (cannot reproduce)

it doesn't appear that this is reproducible on a fresh install - Marking as "cannot reproduce."

Please re-open if you can provide steps to reproduce the problem and we'll debug it.