Internal error when fetching data using serverless function

I am trying to fix the cors issue by creating proxy using serverless function

Here is my Code for the function

const axios = require("axios");

exports.handler = async (event, context) => {
  // const seconds = event.queryStringParameters.seconds;
  console.log("seconds: ", seconds);

  const seconds = 1668153022
  const targetUrl = `https://blockchain.info/blocks/${seconds}000?format=json`;

  try {
    const response = await axios.get(targetUrl);
    return {
      statusCode: 200,
      body: JSON.stringify(response.data),
    };
  } catch (error) {
    return {
      statusCode: 500,
      body: JSON.stringify(error),
    };
  }
};

When I go to http://localhost:9000/get-data?seconds=1668153022 I get internal error 500
I have hard-coded the seconds value for testing purposes.
Ps: no API key is required to fetch data from this API and you can check the data by putting it in chrome

I fixed the issue by changing the import statement to
import axios from "axios"