小程序云函数向AWS Lambda 云函数发送POST请求报错?

我用这种(https://iraiejyk2nwh5rvuxhcla0qmaaj.lambda-url.us-east-1.on.a...第二步是什么?)方式,直接请求可以成功。

但是在小程序云函数中发送POST请求就报错“Request failed with status code 502”

async function chat(event, wxContext) {
   const URL =
      "https://iraiejyk2nwh5rvuxhcla0qmaaj.lambda-url.us-east-1.on.aws/";
   const { content: input } = event.value;
   const requestData = {
      input, // Use the input parameter from the event
      userID: "7260123456789072601234567890",
      windowID: "7260123456789",
   };

   try {
      const response = await axios.post(URL, requestData);
      return response.data;
   } catch (error) {
      console.error("Error while making the request:", error.message);
      throw error;
   }
}
阅读 2.3k
1 个回答

已解决,问题出在AWS Lambda 上