You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The handler-function arguments for httpTrigger functions seem to be in the wrong order when creating a new httpTrigger function.
When I run the func new command (locally in a terminal) and select httpTrigger as the function type, a file with this content is generated:
const{ app }=require('@azure/functions');app.http('httpTrigger',{methods: ['GET','POST'],authLevel: 'anonymous',handler: async(request,context)=>{context.log(`Http function processed request for url "${request.url}"`);constname=request.query.get('name')||(awaitrequest.text())||'world';return{body: `Hello, ${name}!`};},});
If I run the function with func start, the function throws this error to the console and gives me a 500 error in the browser:
After changing the order of the arguments from the handler function to have context first and request as second (handler: async (context, request)), my function works as expected.
Is this a known issue?
The text was updated successfully, but these errors were encountered:
lobunto
changed the title
New httpTrigger function seems to have wrong parameter order
func new httpTrigger seems to have wrong parameter order
May 2, 2023
The template is correct. My guess is you are on an old version of the npm package. Can you make sure you're on @azure/functions v4.0.0-alpha.9 or greater?
The handler-function arguments for
httpTrigger
functions seem to be in the wrong order when creating a new httpTrigger function.When I run the
func new
command (locally in a terminal) and selecthttpTrigger
as the function type, a file with this content is generated:If I run the function with
func start
, the function throws this error to the console and gives me a500
error in the browser:After changing the order of the arguments from the handler function to have context first and request as second (
handler: async (context, request)
), my function works as expected.Is this a known issue?
The text was updated successfully, but these errors were encountered: