-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling an external REST function #144
Comments
Hi @jaroslavpsenicka , at the moment no (not yet officially released), but we are working on new type of node called CustomNode, it will allow you to code any node/block and use it during graph evaluation. Take a look at this comment: #124 (reply in thread) Also, in Open Source you can code it, in our BRMS it will be exposed as HTTP/REST integration. For your use case, GoRules will indeed be capable of orchestrating calls to other services during evaluation. |
I hope that will never ever ever happen :) I consider not blocking fetch/get/fopen/... of the v8 as security risk. (Probably an opt-in would be ok at compile time or via enviornment variables) Zen rule files can become a major security risk - als code can download anything from the internet and use eval() to do nasty things. |
We have moved away from V8 to QuickJS a few releases back. And as you've correctly pointed out, there are some security implications that we'd need to consider before enabling such as support. Our function nodes are currently very limited, and they cannot:
It will very likely remain this way or we might make it configurable at some point. What you are able to do now however, is utilise custom nodes in order to achieve fetch functionality inside GoRules ZEN. EDIT:
And there are obvious reasons why this should never be done in general. Instead, it might make more sense to prevent usage of eval rather than block implementation of fetch in the future. |
Hi @jaroslavpsenicka, this is something that is supported with Function v2, but we will have to document usages. We'll provide an update soon. |
Hi @jaroslavpsenicka , this function is supported already @stefan-gorules, while this works, I am wonder if I can use the import http from 'http';
export const handler = async (input) => {
let data = {};
http.get('https://api.example.com/data').then(response => { data = response.data }).catch(err => { data = { err} });
return data;
}; |
Hi all, just wonder whether I may call an external REST function from the function block, via
fetch
.This may be advantageous for us, where we have a legacy system doing all sort of calculations - when we expose these calculations as REST services, we may orchestrate them using the rule engine. Later on, we may gradually rewrite these into decision tables and functions.
The text was updated successfully, but these errors were encountered: