uncaughtException: cb.apply is not a function While adding dependency in manifest file

I am trying to add dependency in Manifest.json file.

//manifest.json

{
  "platform-version": "2.2",
  "product": {
  "freshdesk": {
	"events": {
        "onTicketCreate": {
        "handler": "onTicketCreateHandler"
        }
      }
  }
  },
  "dependencies": {
	    "nodemailer": "6.6.5"
  },
  "whitelisted-domains":[]
}

At fdk run, getting the following error:
    
*Installing dependencies...*
    *uncaughtException: cb.apply is not a function*
    *TypeError: cb.apply is not a function*
    *    at /usr/local/lib/node_modules/fdk/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18*
    *    at FSReqCallback.oncomplete (fs.js:169:5)*
    *{"date":"Tue Feb 08 2022 06:41:47 GMT+0530 (India Standard Time)","error":{},"exception":true,"level":"error","message":"uncaughtException: cb.apply is not a function\nTypeError: cb.apply is not a function\n    at /usr/local/lib/node_modules/fdk/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18\n    at FSReqCallback.oncomplete (fs.js:169:5)","os":{"loadavg":[5.56298828125,4.814453125,4.58349609375],"uptime":1200434},"process":{"argv":["/usr/local/Cellar/node@12/12.22.9/bin/node","/usr/local/bin/fdk","run"],"cwd":"/Users/rusharma/Documents/projects/freshworks/custom-apps/airtel-pay-find-number-serverless-fd-ticket-view","execPath":"/usr/local/Cellar/node@12/12.22.9/bin/node","gid":20,"memoryUsage":{"arrayBuffers":1690837,"external":5934098,"heapTotal":105713664,"heapUsed":66272320,"rss":137433088},"pid":30027,"uid":501,"version":"v12.22.9"},"stack":"TypeError: cb.apply is not a function\n    at /usr/local/lib/node_modules/fdk/node_modules/npm/node_modules/graceful-fs/polyfills.js:287:18\n    at FSReqCallback.oncomplete (fs.js:169:5)","trace":[{"column":18,"file":"/usr/local/lib/node_modules/fdk/node_modules/npm/node_modules/graceful-fs/polyfills.js","function":null,"line":287,"method":null,"native":false},{"column":5,"file":"fs.js","function":"FSReqCallback.oncomplete","line":169,"method":"oncomplete","native":false}]}*

FDK version: 6.13.1
Node.js version: v12.22.9

Earlier the dependency adding was working. Based on my debugging the error is related to the dependency section only. Is it related to FDK version upgrade to FDK 7 ?

Hi Rupendra Sharma
Good day!

Welcome to Freshworks Developer Community!

I tried adding the same nodemailer dependency to my app in local and it installed successfully.
FDK version - 7.3.0.
Node version - v12.22.9 and v12.18.2

Can you try upgrading to fdk 7 and try again - FDK v7.0 - Announcing Node.js v12 and ES6+ support.

Another solution that seems to have worked for many - https://github.com/nodejs/help/issues/2874

@banu thanks, although I have assumed the same while adding this question here and already upgraded the FDK to 7.0. it is resolving the dependencies now so all good.

Now I think @Freshworks should focus on updating the platform documentation and the FDk template apps so that new app should be automatically targeting the v2.2. Or I have missed some announcements?

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