Cannot find module 'axios'

Options

Hi everyone!

I am trying to run the following Lambda code, but it returns the error as described in the title. Is this not possible, or am I doing something wrong? I believe that the Axios library is included in Xano.

const axios = require('axios');
const chessUrl = 'https://api.chess.com/pub';const user = input.username;
axios.get(`${chessUrl}/player/${user}/games/archives`)  .then(response => Promise.all(response.data.archives.map(url => axios.get(url))))  .then(responses => {    const games = responses.flatMap(response => response.data.games);    console.log(JSON.stringify(games));  })  .catch(error => {    console.error(`Error: ${error.message}`);  });

Thanks for checking!

Kind regards,

Robert


Tagged:

Answers

  • Robert Freericks
    Options

    I've discovered that there is no need to declare the const axios. With that and some other minor changes, the code is working perfectly fine. No need to answer anymore! :)