"Unsupported Media Type" using serverless offline

Viewed 922
1 Answers

there are three possible solutions.

  1. Make sure that the lambda_A have the same port and host where the lambda_B is running.

Lambda_A:

const { Lambda } = require('aws-sdk');

const lambda = new Lambda({
  region: 'us-east-1',
  endpoint: 'http://localhost:3000',
});

module.exports.main = async (event, context) => {
  // invoke
}

Lambda_B: Is running on http://localhost:3000

  1. You have configured out serverless-offline in twice functions.

https://www.serverless.com/plugins/serverless-offline#usage-with-invoke

  1. Lambda_A or Lambda_B have correctly stage?. Remember to use sls offline --stage local in both functions.
Related