1

I am trying out aws lambda for nodejs, starting with the example, i can't seem to be able to resolve index.handler. i've make sure index.js is in the root directory. appreciate your help.

(EDIT) i'm using the example code from AWS website

const https = require('https')
let url = "https://docs.aws.amazon.com/lambda/latest/dg/welcome.html"   

exports.handler = async function(event) {
  const promise = new Promise(function(resolve, reject) {
    https.get(url, (res) => {
        resolve(res.statusCode)
      }).on('error', (e) => {
        reject(Error(e))
      })
    })
  return promise
}

index.js and test execution error

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
devcc
  • 21
  • 3
  • need share code instead of image – Wang Liang Aug 16 '21 at 15:55
  • Welcome to Stack Overflow. In order to have good experience using the platform, you need to provide details or the actual screenshot of your problem in order to get help from others. Your question is very short or general. Good luck – Aramis NSR Aug 16 '21 at 15:57
  • @MERN thanks. i just added the code. i use a sample code from AWS documentation. – devcc Aug 16 '21 at 16:05
  • @AramisNSR the link goes to the actual screen shot of the folder structure, the code and the test execution error. – devcc Aug 16 '21 at 16:05
  • https://stackoverflow.com/questions/31664313/aws-lambda-function-is-returning-cannot-find-module-index-yet-the-handler-in – Wang Liang Aug 16 '21 at 16:07
  • @devcc before your edit, during the review there was no code segment to your question. thanks for providing better quality question. – Aramis NSR Aug 16 '21 at 16:09
  • @MERN the screen shot shows the correct folder structure. – devcc Aug 16 '21 at 16:22

1 Answers1

1

my error was simply because after saving the edit in the online editor, i need to "Deploy" the save. See deploy button

devcc
  • 21
  • 3