Why event.queryStringParameters.seconds is undefined?

PLEASE help us help you by writing a good post!

I am using netlify function to create a proxy for API endpoint. For some reason, I am getting event.queryStringParameters.seconds even though I ma passing parameter form my frontend

Here is the code

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

  const targerUrl = `https://blockchain.info/blocks/${seconds}000?format=json`;
  try {
    const response = await fetch(targerUrl);
    return {
      statuCode: 200,
      //   .data
      body: JSON.stringify(response),
  } catch (error) {
    return {
      statusCode: 500,
      body: JSON.stringify(error),

React code

  useEffect(() => {
    const getData = () => {

      const url2 = `/.netlify/functions/getData?seconds=${7000000}`;
      console.log("URL2: ", url2);
      // "/blocks/1483228800000?format=json"
        .then((res) => res.json())
        .then((data) => setBlockData(data));

    if (value !== null) {
  }, []);

I am testing this in my local environment by using the netlify-lambda package

Can’t say. Could you share a minimal repo to test this?

This could be the cause. The package is not supposed to be used in modern times anyways. Any specific reason for not using Netlify CLI?

Thanks for the response but I was bale to fix the issue by passing the parameters to the URL while testing