I'm making an HTTP request in an action which obviously takes some time. I want to use the response of that request in another action, but every time I get an error since the request hasn't completed yet so the response variable is empty.

Specifically, I will save the json response from the first action and then pass it to a feed.

I'm using Drupal 8.

I've tried searching every form of words I can imagine and I have found only a single drupal.org thread from Drupal 7 days that didn't even have a solution.

Am I going about this the wrong way?

  • It's really not clear what the problem is because you are talking about custom action code which you haven't posted. If you make a blocking HTTP request, then the code in the action will wait until the request is complete. I don't see where a race condition comes in. Likewise, Rules executes actions in rules one after another, and there's nothing special you have to do to make that happen.
    – anonymous
    Sep 24 at 0:04
  • I'm using the module "rules_http_client" which makes an HTTP request. I should have mentioned this. Currently I'm using a workaround that involves a custom action that just does everything I want in a single php file, but naturally if I can avoid this method it would be preferable.
    – yuuuu
    Sep 24 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.