Getting the error Script node executed prematurely for node module 'amazon-cognito-identity-js-node'

kumarraj764
Participant II

Hi, I am trying to use nodejs in Apigee. Getting below error when I use node module- require('amazon-cognito-identity-js-node');

I have tested the node app locally and its working perfectly.

I have exported all the required modules and when I invoke the api, it throws error.

If I remove the require module amazon-cognito-identity-js-node in server.js, the error is not coming. But I need this module to be present so that I can authenticate cognito user.

Any help would be highly appreciated.

{"fault":{"faultstring":"Script node executed prematurely: missing ; before statement\nmissing ; before statement\n at module.js:439:0\n at module.js:474:0\n at module.js:356:0\n at module.js:312:0\n at module.js:364:0\n at require (module.js:380:0)\n at \/organization\/environment\/api\/node_modules\/amazon-cognito-identity-js-node\/src\/index.js:18:0\n at module.js:456:0\n at module.js:474:0\n at module.js:356:0\n at module.js:312:0\n at module.js:364:0\n

Solved Solved
0 3 353
1 ACCEPTED SOLUTION

sidd-harth
Participant V

Hi @KUMAR PERLA, In apigee after adding modules to package.json, we need to install these modules. This can be done using below API,

https://apidocs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/apis/%7Bapi_name%7D/rev...

BTW if you are using Nodejs and not Hosted Targets, then not all latest modules will work. Because Apigee uses an older version of Nodejs. Explore hosted target option.

View solution in original post

3 REPLIES 3

sidd-harth
Participant V

Hi @KUMAR PERLA, In apigee after adding modules to package.json, we need to install these modules. This can be done using below API,

https://apidocs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/apis/%7Bapi_name%7D/rev...

BTW if you are using Nodejs and not Hosted Targets, then not all latest modules will work. Because Apigee uses an older version of Nodejs. Explore hosted target option.

Sure Siddharth. I will try hosted targets.

Hi Siddharth, When I tried with Hosted target, the module is working fine with out any error.

Thanks a lot for your suggestion.. !!!