ERROR: Cannot find module 'auth0-common-logging'

function (user, context, callback) {
  var HttpWritableStream = require('auth0-common-logging').Streams.HttpWritableStream;
var httpWritableStream = new HttpWritableStream('<<sumo end point>>');

var data = '{"Trigger":"data" }';
httpWritableStream.write(data, function() {
  // Now the data has been written.
});
  // TODO: implement your rule
  callback(null, user, context);
}

when I run the above code, I am getting an error like “ERROR: Cannot find module ‘auth0-common-logging’”.
also, I had tried multiple forms such as of require(‘auth0/auth0-common-logging’)

I used as per below page,

_https://github.com/auth0/auth0-common-logging_

Hello @v-bnatarajan,

I looks like the auth0-common-logging package is available in via npm for use in your own code, but it is not yet available for use in rules. You can check which packages are available for use in rules at Can I require? - Search which node modules you can use in webtask.io, and you can request new packages be added at the link below:

1 Like

Hi @v-bnatarajan,

The ‘auth0-common-logging’ package is currently not available for use from within rules. You may use any of the logging packages at Can I require? - Search which node modules you can use in webtask.io . There’s one for sumologic: GitHub - SumoLogic/js-sumo-logger: Sumo Logic JavaScript SDK for Logging which is currently available from within a rule. Please let me know if you have further questions.

thanks @Omar.A and @markd for the response.

i had implemented in another way ,

function (user, context, callback) {
 var stream  = require('stream');
  var request = require('request');
  var _       = require('lodash');
  var writable = new stream.Writable({
  write: function(chunk, encoding, next) {
  var entry = chunk.toString();
  var json = JSON.parse(entry);
  var self = this;
  request.post({
    url:  configuration.SUMO_URL,
    json: json
  }, _.noop).on('error', function (err) {
    self.emit('error', err);
  });
   return  next();
  } 
});
  
  var data = { 
 "email_template":"Validation Error occured",
 "user_data_id":user.user_id
};
  
    data.rule_name="sendlogs";
    data.email_template="Trigger email in sumo";
   const json = JSON.stringify(data);

  writable.write(json);
  
  
  callback(null, user, context);
}

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.