An Azure service that provides streamlined full-stack web app development.
Hi @Muhammad Rizwan,
Thank you for reaching us regarding the issue.
Your Azure Static Web Apps (Standard tier) managed Functions continue to execute stale code despite successful GitHub Actions deployments and fresh Oryx builds. This affects shared module exports and handler bindings in Node.js, even after fresh worker processes spawn.
- Managed Functions are an Azure Functions application fully managed and deployed by the Static Web Apps service.
- Code deployment is tied to the SWA deployment pipeline (via api_location in the workflow YAML).
- There is no separate Microsoft.Web/sites Function App resource exposed. You cannot use standard az functionapp restart/stop/start commands.
- Refresh of function code is tied directly to a successful SWA deployment. The platform is expected to update the managed Functions host and load the new package.
Run From Package is the underlying mechanism used by Azure Functions (including managed Functions in SWA). A successful deployment should trigger a Functions host restart and mount the new read-only package.
Recommended Resolution Steps
- Trigger a fresh deployment Ensure a meaningful change (e.g., comment or timestamp in the affected files) and redeploy. The platform should handle cache invalidation on successful deployment.
- Clean up preview environments (Recommended) Old preview environments can contribute to shared state.
- In the Azure Portal > Your Static Web App > Environments > Delete all non-production environments.
- Or use CLI:
az staticwebapp environment delete --name <app-name> --environment-name <env-name> --resource-group <rg>
- Tier toggle (Free > Standard) as workaround Changing the SKU recycles the underlying compute and is a documented community-supported escape hatch for persistent stale state in managed Functions when standard deploys do not fully refresh the host.
Long-term recommendation: Bring Your Own Functions (BYOF) For production scenarios with complex shared modules or reliability requirements, Microsoft recommends linking an external Azure Functions app.
- This gives full control over restarts, slots, scaling, and configuration.
az staticwebapp functions link --name <swa-name> --resource-group <rg> --function-resource-id <function-app-id>
https://learn.microsoft.com/en-us/azure/static-web-apps/apis-functions
https://learn.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
Kindly let us know if the above helps or you need further assistance on this issue.
Please "accept" if the information helped you. This will help us and others in the community as well.