exports.handler = async (event, context) => { const response = { statusCode: 200, headers: { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "Content-Type" }, body: JSON.stringify('Lambda function executed successfully') }; return response; };
现在您的Lambda函数已启用CORS,并且可以被跨域请求。