AWS Lambda Cache do następnej odpowiedzi

/*
It's your code that's caching the response. Not Lambda.

To fix it, you have to fix your code by making sure that you invoke the API inside your handler and return it without storing it outside your handler function's scope.

For illustration purposes,
*/
//Don't

const response = callAnApi()

async function handler(event, context, callback) {
  // No matter how many times you call the handler,
  // response will be the same
  return callback(null, response)
}
Do

async function handler(event, context, callback) {
  // API is called each time you call the handler.
  const response = await callAnApi()

  return callback(null, response)
}
//Reference: AWS Lambda Execution Model

// Any declarations in your Lambda function code (outside the handler code, see Programming Model) remains initialized, providing additional optimization when the function is invoked again. For example, if your Lambda function establishes a database connection, instead of reestablishing the connection, the original connection is used in subsequent invocations. We suggest adding logic in your code to check if a connection exists before creating one.
Light Lark