Azure / Azure/static-web-apps

Issue with ?code query parameter

Open
#165 13 comments 2 reactions 0 assignees View on GitHub
bug Functions
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Hello

I'm having an issue with the functions side of my static web application using Azure Static Apps.

I've found that having a query parameter of 'code' is causing issues with my function

I've created a test trigger with the default HTTP trigger TypeScript code for an example.

```
import { AzureFunction, Context, HttpRequest } from "@azure/functions"

const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise {
context.log('HTTP trigger function processed a request.');
const name = (req.query.name || (req.body && req.body.name));
const responseMessage = name
? "Hello, " + name + ". This HTTP triggered function executed successfully."
: "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.";

context.res = {
// status: 200, /* Defaults to 200 */
body: responseMessage
};

};

export default httpTrigger;
```

**With no query parameter, works as intended**

https://domain/api/TestTrigger

**With query parameter, works as intended**

https://domain/api/TestTrigger?name=Test

**With unsupported query parameter, works as intended**

https://domain/api/TestTrigger?foo=bar

**With code query parameter, 500 error**

https://domain/api/TestTrigger?code=code

This is causing issues for me handling an Oauth2 callback from Spotify which uses the 'code' query parameter.

Any idea to why this is happening and how this can be resolved? This was never an issue when deploying the code as a standalone function app as opposed to Azure Static Web Apps.

Thanks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.