serverless / serverless-azure-functions

Serverless Azure Functions Plugin – Add Azure Functions support to the Serverless Framework
MIT License
266 stars 162 forks source link

return bindings must specify a direction of 'out' #447

Closed kokokenada closed 4 years ago

kokokenada commented 4 years ago

This is a Bug Report

Description

When running sls offline, an error was thrown and it was not obvious what corrective action is needed and perhaps it is a bug.

Additional Data

serverless.yml:

service: name: csa-api

app and org for use with dashboard.serverless.com

app: csa-api org: XXX

Add the serverless-webpack plugin

plugins:

provider: stage: ${env:REACT_APP_GIT_BRANCH, 'dev'} name: azure runtime: nodejs10.x region: ${opt:region, 'West US'} # Overwrite the default region used. apim: apis:

functions: auth: name: csa-auth-${env:REACT_APP_GIT_BRANCH} handler: build/src/graphql.handler events:

package: # Optional deployment packaging configuration include: # Specify the directories and files which should be included in the deployment package

tbarlow12 commented 4 years ago

@kokokenada in your function configuration, you specify the name of $return for the output. By using the keyword $return, you are telling the azure function to just accept whatever value is returned from the function. The default, res, requires you to set the res value on the context object for the result. Check out the docs for more info. This is only the case for output bindings. It doesn't make sense to return for an incoming binding. Please reach out if you have other questions