Im having a bit of trouble here with a Lambda function.
I am trying to make an API call through Axios through a lambda function. I have tested the call in Postman and I am sure that it is working.
It looks like from the cloudwatch logs that i just does not call the function at all. I am thinking that there is something wrong with my setup on AWS but I can't think what it could be.
import:
import axios from 'axios';
Function called:
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,
};
}