Question

Photo of Kelvin Liu

0

webrequest not running??

Hi

I have noticed that since sometime in mid March our lava codes which use webrequest have all been failing silently. No noticeable errors just suddenly not doing what it has been doing for more than a year(s). We were on Rock v9.x ... Just upgraded to 10 (in May) but I know it's not related to the upgrade because the problem has been there since March.

Hitting the api directly via Power Tools->Api, web browser or Postman works fine.

{% webrequest

url:'somedomain.com/api/Groups/8309'

headers:'Authorization-Token^somekey' %}

Response: {{ results | ToJSON }}

{% endwebrequest %}

Returns 

Response: "0: "

Extra notes:

  • Changing to invalid endpoint: ex. Groupsx returns same result of "0: "
  • Changing to wrong auth token returns same result of "0: "

Can anyone shed any light on this?

Thank you

  • Photo of Nick Airdo

    0

    Hi Kevin,

    I don't know if you sorted this out yet, but the only thing I noticed about that which likely won't work is having the `webrequest` Lava command split across multiple lines. If you do it like this (as seen on the pre-alpha site)

    <pre>
    {% webrequest url:'http://prealpha.rocksolidchurchdemo.com/api/Groups/112' headers:'Authorization-Token^qtYthmh9aCIMkR8VfJipD1Ar' %}
            Response: {{ results | ToJSON }}
    {% endwebrequest %}
    </pre>

    ...it should be working as seen here: https://prealpha.rocksolidchurchdemo.com/intranet/employee-resources
    example showing webrequest

    Other than that, I would be remiss if I didn't mention that you should really consider updating to one of the latest secured versions of Rock mentioned in the top right corner of the Release Notes page at https://community.rockrms.com/releasenotes