It sounds like your Azure Static Web App (SWA)
is not recognizing your staticwebapp.config.json
file, because of that authentication is not working correctly.
Make sure the staticwebapp.config.json
file is in the correct location:
The file must be placed at the root of your built output.Since you're using workspaces packages/webapp
, packages/chat-component
, your build process might not be copying it correctly.
- Place
staticwebapp.config.json
inpackages /webapp/public/
. - Run your build command (
npm run build
). - Check the output directory (e.g.,
packages/webapp/dist/
orpackages/webapp/build/
). - Confirm that
staticwebapp.config.json
exists in the final build output. If it's missing, you need to copy it manually using a script:- Add this to
package.json
:"scripts": { "postbuild": "cp staticwebapp.config.json dist/" }
- Then, run the build again and check the dist/ folder.
- Add this to
Validate staticwebapp.config.json
ensure there are no syntax errors in staticwebapp.config.json
.
Check Logs in Azure:
- Go to Azure Portal ->Your Static Web App.
- Open Logs (
Diagnostic Settings
). - Check if it says, "No valid staticwebapp.config.json found".
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.