Start a new topic
Solved

Error while running "fdk validate"

I have created my first serverless app by following the steps in freshdesk document, while trying to validate using command 'fdk validate' facing the below error


Validation failed due to the following issue(s):

server/server.js::2: Parsing error: The keyword 'const' is reserved


My server.js code:


'use strict';

const unirest = require('unirest');

exports = {

  events: [

    { event: 'onTicketCreate', callback: 'onTicketCreateHandler' }

  ],


  // args is a JSON block containing the payload information.

  // args['iparam'] will contain the installation parameter values.

  onTicketCreateHandler: function(args) {

    console.log('Hello ' + args['data']['requester']['name']);

  }


};


tried with below methods to rectify the error,

 - tried in different versions of node v6.10.0, v8.11.2, v10.4.0

 - tried adding the .eslintrc file to the project by eslint

 - used different IDE's VS code, Sublime, notepad

 - alternatively, use 'var' in place of 'const' even error throws in other node js syntax.

  eg: obj.then(response=>{..........}); //error throws in =>

Able to run other node projects, whereas while using fdk alone am facing this issues.

Hey Anishkumar,


Sorry for the inconvenience. We have brought in support for ES6 as part of the latest CLI.


Please make sure to install the latest CLI (sudo npm install http://dl.freshdev.io/cli/fdk-4.3.2.tgz -g).


Thanks

Hai Raghuram,


Already the fdk version is up to date, am facing this issue in the latest version


Hey Anishkumar,


Looks like the new version is 4.3.3 and not 4.3.2.


Install - npm install http://dl.freshdev.io/cli/fdk-4.3.3.tgz -g


Please let us know if the issue still persists.


Thanks.


1 person likes this

Hi Raghuram,


Thanks for your response.The 'const' issue has been resolved. 

I am using an external libraries '@google-cloud/dlp' also added this to manifest file and able to see the package under node_module/@google-cloud folder but while executing the program facing the below error.


{ Error: Cannot find module '/home/think42/Documents/Project/Maskinfo/server/node_modules/dlp'

    at Function.Module._resolveFilename (module.js:469:15)

    at Function.Module._load (module.js:417:25)

    at Module.require (module.js:497:17)

    at require (internal/module.js:20:19)

    at loadDependency (/usr/local/lib/node_modules/fdk/lib/event_handler/framework.js:35:10)

    at require (/usr/local/lib/node_modules/fdk/lib/event_handler/framework.js:108:16)

    at server.js:40:13

    at server.js:180:20

    at ContextifyScript.Script.runInContext (vm.js:35:29)

    at ProductEvent.sandboxExecutor (/usr/local/lib/node_modules/fdk/lib/event_handler/framework.js:186:25) code: 'MODULE_NOT_FOUND' }



PFA

json
(154 Bytes)

Hey Anishkumar,


Currently, we don't provide the ability to use scoped npm packages as part of the app and we'll be adding this in the future.


Thanks,

Raghuram. P


1 person likes this

Hey Anishkumar,


We have introduced the support for scoped npm packages as part of our new CLI (version - 4.3.6). Please update to the latest version.


Thanks,

Raghuram. P

Login or Signup to post a comment
JS Bin