Freshsales Server Method Invocation

Hello,
I am trying to use snowfllake-sdk on a freshsales app. The sdk would be available as a serverless function to be accessed via Server Method Invocation.

My current manifest.json has the following

  "dependencies": {                                                                                                                                                                                            
      "snowflake-sdk" :  "1.5.2"                                                                                                                                                                                    
  }      

When i try to use it in the serverless handler via var Snowflake = require('snowflake-sdk') . Snowflake is empty.
This code works well on my development machine (in dev mode) but the package is not visible when i put it on freshsales.

What would be the best way to debug an issue like this?

Hello Avinash, Welcome to the community :boom:

Can you rewrite both the key and value (“snowflake-sdk”: “1.5.2”) within the quotes, stop the fdk and run it again. Check if the module is found inside node_modules folder

Hi @shravan.balasubraman, Thankyou.

  1. The key, value are both within quotes -> sorry it seems like my editor didn’t copy it while copying.
  2. snowflake_sdk is not available in node_modules folder (but it works locally). I can see the following in the log
Please ensure that the following are addressed for quick review process.
[WARN] iparam_test_data.json is deprecated, to test the installation page, visit - http://localhost:10001/custom_configs

Installing dependencies...
/media/avk/system/avk/Programs/fs_app_snowflake/server
└── snowflake-sdk@1.5.2 

Starting local testing server at http://*:10001/    
Append 'dev=true' to your Freshsales account URL to start testing    
e.g. https://domain.freshsales.io/contacts/2007663673?dev=true    
Quit the server with Control-C.

Is it possible to see logs for the app i put on freshsales?

Hi @avinash,

You can view the serverless logs. Please refer to this Wiki for the steps.

  1. Do you see any error from SMI invocation?
  2. Does the rest of the code works fine while only the imported library is empty?

Hello @Raviraj

No, Just the request parameters from my app to the Serverless Handler

Right. The imported library is empty. So my variable after var a = require("snowflake-sdk") is {} whereas it should’ve had the exported parameters (which i can see on my local via fdk run)

I tested this with a simple “test application” and have been able to reproduce this issue. It would be really helpful if i could share the bundled app with someone to debug the issue.

Hi Avinash,

I will send you a personal message (private) here where you can share the bundled app of the simple application with the package.

We have figured out that this NPM package is a bit large and takes more time to load which is why it is empty during the function execution. I will add it to our list to add more memory to the serverless function so that the library will be loaded and the function execution will be complete within time.

I will confirm after it is done. Please hold on.
Thanks.

Hi @Raviraj ,
could you send me a message so that i could share the bundled app of the simple application.

Thanks,
Avinash

We have added the package to our list to add more resources to the serverless functions. The library will load quickly upon uploading a new version now.