Skip to main content

Error while executing App server script! - Cannot find module

  • September 18, 2018
  • 2 replies
  • 100 views

Hey,


I am trying to create a serverless app that communicates with our system using our API.


The error I am getting after uploading and installing the custom app is:

{
  "requestID":"5b2a9fe3-6162-4bd9-bf63-59306164fc1d",
  "status":500,
  "message":"Error while executing App server script! - Cannot find module './developer/node_modules/http'",
  "errorSource":"APP"
}

Dependencies in my manifest file look like this:

"dependencies": {
  "ntlm": "0.1.3",
  "request": "2.88.0",
  "http": "0.0.0"
}

I am using request to make the actual request and ntlm for authentication. I also tried to add http here but that does not seem to solve my issue.


As for my code:

  1. I am using require as follows:
    const ntlm = require('ntlm');
    const http = require('http');
    const request = require('request');

    Again I tried to add http here, but I was getting the error without this line as well.

  2. I am using an http agent as this was the only way I was able to make the ntlm authentication work.
    let ntlmrequest = request.defaults({
    	agent: request.http.Agent({
    		keepAlive: true,
    		maxSockets: 1,
    		keepAliveMsecs: 3000,
    	}),
    });
  3. My app exports 2 functions which I then invoke in the frontend part of my app after app.initialized() function. The first function is a bit more complicated, but the other one is really simple:
    test: args => renderData(null, args)
     yet still returns the same error.

I am using "Bash on Ubuntu on Windows" to pack the app. Node version 6.14.4 and fdk version 4.4.1.


Did this topic help you find an answer to your question?
This topic has been closed for comments

2 replies

Hi,



Currently we do not support 'http' module. I will discuss with our PM and create a ticket to add support for 'http'.


Sorry, I could not help you with any workaround as it requires changes in our CLI.



Thanks,

Janani V.


  • Author
  • Apprentice
  • 2 replies
  • September 27, 2018

Hi,


I figured that out already, just forgot to update this topic. I found my answers in the documentation.


You do not need to request adding the http module, I have switched to https as that solves this issue and is just better anyway.


Thanks