Sto tentando di inviare una richiesta semplice con aws lambda.semplice esempio node.js in aws lambda
La mia struttura del modulo è la seguente:
mylambda
|-- index.js
|-- node_modules
| |-- request
ho comprimere il file e si è caricato lambda.
Quindi lo invoco e restituisce il seguente errore. "errorMessage": "Cannot find module 'index'"
Ecco il contenuto dei file di index.js
var request = require('request');
exports.handler = function(event, context) {
var headers = { 'User-Agent': 'Super Agent/0.0.1', 'Content-Type': 'application/x-www-form-urlencoded' }
// Configure the request
var options = {
url: 'https://myendpoint',
method: 'POST',
headers: headers,
form: {'payload': {"text":""} }
}
// Start the request
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body)
}
})
console.log('value1 =', event.key1);
context.succeed(event.key1); // Echo back the first key value
};
Ogni aiuto è apprezzato, grazie
Qual è il valore "Gestore" nella configurazione della funzione Lambda? –
index.handler, Il codice funziona bene e si verifica quando rimuovo la chiamata al modulo di richiesta –