Jump to content

Sage x3 node modules


 Share

Recommended Posts

Hello everyone, 

I want to use some javascript in my L4G code .

In the first place, I'm following this tuto as an introduction  : https://online-help.sageerpx3.com/erp/12/wp-static-content/static-pages/en_US/v7dev/integration-guide_4gl-crypto-bundle.html

I've following all instructions but when i want to execute the L4G code, it doesn't work . 

This is the result i got in the RESHEADER image.jpeg.4c5d2a6154d3d4e47d9873362518cd06.jpeg

 

I don't understand why he can't find my module 

 

Thank ! 

 

PS : Yes I've restart Sage Syracuse NODE0

Link to comment
Share on other sites

  • 5 months later...
  • 1 month later...
On 3/28/2024 at 1:55 AM, Manish JOGEEAH said:

Hello Jules,

Did you find the solution for this issue?

Thanks.

I would almost guarantee this particular 404 has to do with misplacement of the module extension within the file structure or a naming typo, HOWEVER, please be advised that Sage's example, which is quite dated, currently contains malformed / deprecated javascript which will not compile (response 500).  The function code is not correctly structured within the crypo-helper.js file.

Sage Example Code:

exports.digest(text) {
    var hash = crypto.createHash('sha1');
    hash.update(text, 'utf8');
    return hash.digest('hex');
}

Corrected Example Code:

exports.digest = function(text) {
    var hash = crypto.createHash('sha1');
    hash.update(text, 'utf8');
    return hash.digest('hex');
}

Make this change, restart your node.  Now the header should look like this and the function should be callable within 4GL.

image.png.5e38901e2785a15682c7430b49593cf3.png

image.png.1206e2931f9c1f7781198490d33a5de8.png

hope this helps. 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...