I need to await a nodejs function that runs a node-fetch requisition but it's presenting "Internal Server Error". This is a lambda function on aws and the url target is public and accessible. What I'm doing wrong?
My code:
const AWS = require('aws-sdk');
const fs = require('fs');
const { v4: uuidv4 } = require('uuid');
const fetch = require('node-fetch');
async function fetchLogin(){
const url = 'https://www.url.../test.txt';
const res = await fetch(url);
return res;
}
exports.index = async (event, context, callback) => {
const fetchResult = await fetchLogin();
return response(200,'text/html', fetchResult);
};