Forum Discussion
ILX: could not obtain service. invoked from within "ILX:
HI everyone,
I'm playing around with ILX and trying to send a SMS text message everytime a user logs into my device (on a particular URL) - for this I've used the Twilio example, but the .js file doesn't kick off at all: in the logs I have:
Rule /Common/plugin_twilio/irule_twilio <ACCESS_POLICY_AGENT_EVENT>: sendMessage failed for user: xxx@wontoso.com, ILX failure: ILX: could not obtain service. invoked from within "ILX::call $rpc_handle sendMessage $username $telephoneNumber $sender "
The call in my iRule:
set rpc_handle [ ILX::init plugin_twilio extension_twilio]
if {[ catch { ILX::call $rpc_handle sendMessage $username $telephoneNumber $sender } result ] } {
.....
my index.js obviously has that method:
// Import the f5-nodejs module.
var f5 = require('f5-nodejs');
// Create a new rpc server for listening to TCL iRule calls.
var ILX = new f5.ILXServer();
const accountSid = 'somethingsecret'; // Your Account SID from www.twilio.com/console
const authToken = 'andmoresecret'; // Your Auth Token from www.twilio.com/console
const client = require('twilio')(accountSid, authToken);
ILX.addMethod('sendMessage', function(req, res) {
console.log('Method Invoked, Arguments:', objArgs.params());
var username = req.params()[0];
var telephoneNumber = req.params()[1];
var sender = req.params()[2];
var message = username + ' logged in to F5';
client.messages.create({
body: message,
to: telephoneNumber, // Text this number
from: sender // From a valid Twilio number
})
.then(message => console.log(message.sid));
});
Any ideas?
- Satoshi_Toyosa1Ret. Employee
From "<ACCESS_POLICY_AGENT_EVENT>" in the error message, I suspect K54205668: iRules LX is not compatible with ASM/APM policies. Remove the policies (if you can) and try again. As far as I know, the twilio NPM package should work with iRules LX.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com