Open alex88 opened 3 years ago
Trying with:
api-xml:
handler: api.getPost
events:
- http: true
route: api/xml
name: $return
logs
Serverless: Finished building offline service
Serverless: Spawning process 'func host start'
Azure Functions Core Tools
Core Tools Version: 3.0.3331 Commit hash: 0b57b1647c5a385beb8f7d64fa0e534ad4c7555d
Function Runtime Version: 3.0.15371.0
[2021-03-08T05:06:59.764Z] The 'api-xml' function is in error: $return bindings must specify a direction of 'out'.
[2021-03-08T05:06:59.824Z] Worker process started and initialized.
which seems to set $return
also into the in
binding, the temp function folder function.json shows
{
"disabled": false,
"bindings": [
{
"type": "httpTrigger",
"direction": "in",
"name": "$return",
"route": "api/xml",
"authLevel": "function"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
"entryPoint": "getPost",
"scriptFile": "../api.js"
}
For anyone else who finds this (possibly related to Apollo server) this comment solves this problem, too. For reference, the solution is:
graphql
handler: api.graphql
events:
- http: true
methods:
- GET
- POST
- OPTIONS
authLevel: function
- http: true
direction: out
name: '$return'
@alex88 , if you hadn't figured this out already, there you go.
This is a Bug Report
Description
I'm trying to set the output binding name to
$return
to use the async function return type, using the code seen in https://github.com/serverless/serverless-azure-functions/pull/308#issuecomment-591517905 (because I couldn't find any documentation of the possible values) it throws an errorIt should've changed the out binding name to
$return
Additional Data
It seems that here https://github.com/serverless/serverless-azure-functions/blob/master/src/shared/bindings.ts#L49
displayName
is$httptriggerout_displayname
while the closest available options are: