Hi everyone,
This is kind of a follow up question to this one: Conversational Action AccessToken
If I use the jovo webhook in my action console and run the action on my computer I can access the token with:
this.$host.headers[‘authorization’]
But after loading the zip file into my AWS lambda function and configure an AWS API Gateway, the headers are always undefined:
Cannot read property ‘authorization’ of undefined
Do you have an idea why the token is missing here? And how I can access it?
this.$request?.getAccessToken(); // returns also undefined
That’s what I get for this.$host:
{
"isApiGateway": false,
"responseHeaders": {
"Content-Type": "application/json; charset=utf-8"
},
"hasWriteFileAccess": false,
"event": {
"handler": {
"name": "Jovo"
},
"intent": {
"name": "actions.intent.MAIN",
"params": {},
"query": "Talk to launcher"
},
"scene": {
"name": "actions.scene.START_CONVERSATION",
"slotFillingStatus": "UNSPECIFIED",
"slots": {},
"next": {
"name": "MainMenuScene"
}
},
"session": {
"id": "ABwp...sw",
"params": {},
"typeOverrides": [],
"languageCode": ""
},
"user": {
"locale": "en-US",
"params": {},
"accountLinkingStatus": "LINKED",
"verificationStatus": "GUEST",
"packageEntitlements": [],
"gaiamint": "",
"permissions": [],
"lastSeenTime": "2021-08-24T06:19:50Z"
},
"home": {
"params": {}
},
"device": {
"capabilities": [
"SPEECH",
"RICH_RESPONSE",
"LONG_FORM_AUDIO"
],
"timeZone": {
"id": "Europe/Zurich",
"version": ""
}
}
},
"context": {
"callbackWaitsForEmptyEventLoop": true,
"functionVersion": "$LATEST",
"functionName": "LaunchSpeechApp",
"memoryLimitInMB": "128",
"logGroupName": "/aws/lambda/LaunchSpeechApp",
"logStreamName": "2021/08/24/[$LATEST]ec7...6d74",
"invokedFunctionArn": "arn:aw...eechApp",
"awsRequestId": "df3a6...3010"
},
"$request": {
"handler": {
"name": "Jovo"
},
"intent": {
"name": "actions.intent.MAIN",
"params": {},
"query": "Talk to launcher"
},
"scene": {
"name": "actions.scene.START_CONVERSATION",
"slotFillingStatus": "UNSPECIFIED",
"slots": {},
"next": {
"name": "MainMenuScene"
}
},
"session": {
"id": "ABwp...sw",
"params": {},
"typeOverrides": [],
"languageCode": ""
},
"user": {
"locale": "en-US",
"params": {},
"accountLinkingStatus": "LINKED",
"verificationStatus": "GUEST",
"packageEntitlements": [],
"gaiamint": "",
"permissions": [],
"lastSeenTime": "2021-08-24T06:19:50Z"
},
"home": {
"params": {}
},
"device": {
"capabilities": [
"SPEECH",
"RICH_RESPONSE",
"LONG_FORM_AUDIO"
],
"timeZone": {
"id": "Europe/Zurich",
"version": ""
}
}
}
}
thank you!
EDIT 31.08.2021:
I just tried to host the code on Google Cloud Platform and tested the action from the google action console. There I get a host object with headers and also the authorization token. So it has maybe something to do with the API Gateway and Conversational Actions?
Another Action I made, but with dialogflow, works with the API Gateway.