After import the rules script here I'm getting an error. How do you take out what I imported and clear out this error:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 2 passed to Drupal\rules\Engine\ExpressionManager::createInstance() must be of the type array, null given, called in C:\wamp\www\sitefolder\web\modules\contrib\rules\src\Engine\RulesComponent.php on line 72 in Drupal\rules\Engine\ExpressionManager->createInstance() (line 37 of modules\contrib\rules\src\Engine\ExpressionManager.php).

Drupal\rules\Engine\ExpressionManager->createInstance(NULL, NULL) (Line: 72)
Drupal\rules\Engine\RulesComponent::createFromConfiguration(Array) (Line: 137)
Drupal\rules\Entity\RulesComponentConfig->getComponent() (Line: 115)
Drupal\rules\Entity\RulesComponentConfig->getExpression() (Line: 88)
Drupal\tr_rulez\Controller\RulesComponentListBuilder->buildRow(Object) (Line: 235)
Drupal\Core\Entity\EntityListBuilder->render() (Line: 245)
Drupal\tr_rulez\Controller\RulesComponentListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing('rules_component')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

ojchris37 created an issue. See original summary.

ojchris’s picture

Issue summary: View changes
tr’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

What script did you try to import and how did you try to import it?

ojchris’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Active

Going by the comment here https://www.drupal.org/project/rules/issues/2768737#comment-12769122, the issue seem to be around using typed in "node" into the Node value box, as I have a rule with that and then the imported one. Both don't show up in the admin/config/development/configuration/export section.

I have tried to apply this patch: https://www.drupal.org/project/rules/issues/2768737#comment-12612278 but found a lot seem to have changed in the code since the patch is from 2 years ago, not sure it's safe to use now.

ojchris’s picture

@TR this script https://www.drupal.org/project/rules/issues/2852342#comment-12637977 imported by clicking on "import rule" which takes one to http://site.local/admin/config/development/configuration/single/import. I selected simple configuration for configuration type and pasted the rule in the "Paste your configuration here" box.

Once I clicked submit it appeared fine with "The configuration was imported successfully." but once I clicked the component tab of rules I get the above error. The error is also displayed as a warning across the admin pages.

NB: sorry I had sent the msg in #4 without internet and once internet was restored it changed the status to Major and active

tr’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

Support requests are never major - see the issue priority guidelines linked below.

You didn't answer either of my questions.

tr’s picture

Status: Postponed (maintainer needs more info) » Active

#5 and #6 were crossposted.

It's not a simple configuration, it's a "Reaction Rule”

ojchris’s picture

OK. Any direction on how to remove it to clear the error. Maybe I can then export the db and try again as reaction rule

tr’s picture

Several things:

First, I notice from your post that you're using tr_rulez. tr_rulez needs to run with the current -dev version of Rules, NOT -alpha5. There's a big notice on the project page telling you that ... So the first thing I would do is to upgrade to the current -dev of both Rules and typed_data.

Second, I can't reproduce this problem on simplytest.me. If I set up a site using Rules -dev and import that config, either as a Reaction Rule or as a Simple configuration (being sure to specify the filename properly as rules.reaction.test_rule), then I can successfully import and run that config without an error. So I don't know what went wrong for you - maybe it's as simple as having an old version of Rules. Again, upgrade your Rules!

If you still have a problem after upgrading your Rules module, then you can use drush to remove the imported Rule. Rules provides a drush rules-delete command, but core drush also provides a drush config:delete command that should work.

tr’s picture

Status: Active » Fixed
ojchris’s picture

Thank you for the response. I'll revert with updates at least for others who may run into this

ojchris’s picture

NO MORE errors!

I completely uninstalled and deleted the alpha5. I then reinstalled with the dev version and used "node" for both conditions.

@TR thank you for the direction

Status: Fixed » Closed (fixed)

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

ojchris’s picture