node.js - Axios 帖子未在 AWS lambda 函数上调用
问题描述
我在使用 Lambda 函数时遇到了一些麻烦。
我正在尝试通过 lambda 函数通过 Axios 进行 API 调用。我已经在 Postman 中测试了这个电话,我确信它正在工作。
从 cloudwatch 日志看来,我根本没有调用该函数。我认为我在 AWS 上的设置有问题,但我想不出它可能是什么。
进口:
import axios from 'axios';
调用函数:
public static async refreshToken(refreshToken: string): Promise<IToken> {
let headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": `Basic BASE_64_ENCODED_CODE`
};
let url = "https://api.fitbit.com/oauth2/token?grant_type=refresh_token&refresh_token=REFRESH_TOKEN"
let response = await axios.post(url, null, {
headers
});
return {
accessToken: response.data.access_token,
expiry: Date.now() + response.data.expires_in,
refreshToken: response.data.refresh_token,
};
}
解决方案
推荐阅读
- linux - 设置 NFS 服务器驱动器所有权权限时出现错误 chown: invalid group: 'nobody:nogroup'
- mysql - MYSQL 查询仅访问列标题名称
- ios - 如何使用情节提要设置按钮状态的图像和文本边缘插入
- javascript - 如何在.html模板Angular中的div上定义多种样式
- asp.net - 在浏览器中强制保存对话框
- java - 为成员显示不同的月份
- java - 原因:java.lang.ClassNotFoundException:无法加载请求的类:org.springframework.orm.hibernate4.SpringSessionContext
- ios - didFinishProcessingPhoto 在 for 循环中只执行了 10 次
- google-analytics - 谷歌分析的目标数据阅读器
- python - Selenium WebDriver 无法单击元素,即使它似乎是可见的