Azure / Azure/static-web-apps

Bug: Routes tab gone in portal and auth not working

Open
#1,623 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I have been trying a couple of times now with multiple Azure Static Web Apps. It all works smooth when no authentication is used, but once I add some auth routes, it starts failing. Although, the deployments work fine, but on the Azure portal, the **routes** tab is missing.

This is what I get before I apply any routes:

Image

When apply the following configuration (or any configuration):

```json
{
"responseOverrides": {
"404": {
"rewrite": "/index.html",
"statusCode": 200
}
},
"navigationFallback": {
"rewrite": "/index.html"
},
"routes": [
{
"route": "/success",
"allowedRoles": ["admin"]
}
]
}
```

In the portal the routes tab is gone:

Image

The authentication or routes are not working. I can navigate to `/success`, but still I can reach the page without being logged in.

Image

Image

A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a project with some auth routes (like the above configuration)
2. Deploy with the SWA CLI: `swa deploy -d --env production`
3. Routes are not working after the deployment

```yml
name: Deployment to Azure Static Web App

on:
push:
branches:
- main

jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"

- name: Install dependencies
run: |
npm ci
cd app && npm ci
cd ..
cd api && npm ci

- name: Build
run: npm run build

- name: Clean dependencies
run: cd api && npm ci --omit=dev

- name: Install swa cli
run: npm install -g @azure/static-web-apps-cli

- name: Deploy
run: swa deploy -d ${{ secrets.SWA_API_TOKEN }} --env production

```

**Expected behavior**

I would expect that the `routes` tab would always be visible, even if there is an error, there should be a section on the portal to validate what is wrong with the configuration. Right now, you have no clue why things aren't working as they should be.

**Screenshots**

Image

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.