Azure Static Web Apps breaking when I add a Next.js API endpoint
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I have an Next.js App version 13.4.3 with next-auth 4.22.1 as authentication middleware with Azure AD B2C as provider. The first pages that I created was working as expected but as soon as I added a really simple API endpoint to handle a form submission the app started to crash after the deployment to Azure Static Web Apps (I also using the standalone version due to 100mb limitation). After the endpoint addition, the app is not instanced anymore. Here is the logs from the SWA:
timestamp [UTC] | problemId | handledAt | type | message | assembly | method | outerType | outerMessage | outerAssembly | outerMethod | innermostType | innermostMessage | innermostAssembly | innermostMethod | severityLevel | details | itemType | customDimensions | customMeasurements | operation_Name | operation_Id | operation_ParentId | operation_SyntheticSource | session_Id | user_Id | user_AuthenticatedId | user_AccountId | application_Version | client_Type | client_Model | client_OS | client_IP | client_City | client_StateOrProvince | client_CountryOrRegion | client_Browser | cloud_RoleName | cloud_RoleInstance | appId | appName | iKey | sdkVersion | itemId | itemCount | _ResourceId |
-- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --
13/06/2023, 13:45:20.698 | System.InvalidOperationException at Mono.Unix.UnixFileSystemInfo.AssertValid | | System.InvalidOperationException | | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | System.InvalidOperationException | Path doesn't exist! | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | | | | | 2 | [{"severityLevel":"Warning","outerId":"0","message":"Path doesn't exist!","type":"System.InvalidOperationException","id":"49125766","parsedStack":[{"assembly":"Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","method":"Mono.Unix.UnixFileSystemInfo.AssertValid","level":0,"line":0},{"assembly":"Microsoft.Azure.WebJobs.Script, Version=4.21.0.0, Culture=neutral, PublicKeyToken=null","method":"Microsoft.Azure.WebJobs.Script.Workers.Http.HttpWorkerProcess.AssignUserExecutePermissionsIfNotExists","level":1,"line":75,"fileName":"/src/azure-functions-host/src/WebJobs.Script/Workers/Http/HttpWorkerProcess.cs"}]}] | exception | {"prop__{OriginalFormat}":"Error while assigning execute permission.","HostInstanceId":"7186e66d-92d6-4e70-86b6-9d5ca4ef41c6","FormattedMessage":"Error while assigning execute permission.","ProcessId":"59","LogLevel":"Warning","Category":"Worker.HttpWorkerProcess.dce2ddb4-38d6-4fa2-b7b8-2ccdf50eaea7"} | | | | | | | | | | | PC | | | 0.0.0.0 | | | | | jobcenter-dev-frontend-staticapp | 4A88A912-638222594939962238 | 7c2e2e88-d2aa-4e78-83c0-9b51e11f7916 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins | 0c9d1bfe-8d84-4e71-a335-b57a81ba02ea | azurefunctions: 4.21.3.3 | b02a81fd-09f0-11ee-a66c-6045bd918f3f | 1 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins |
13/06/2023, 13:58:49.762 | System.InvalidOperationException at Mono.Unix.UnixFileSystemInfo.AssertValid | | System.InvalidOperationException | | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | System.InvalidOperationException | Path doesn't exist! | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | | | | | 2 | [{"severityLevel":"Warning","outerId":"0","message":"Path doesn't exist!","type":"System.InvalidOperationException","id":"41658746","parsedStack":[{"assembly":"Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","method":"Mono.Unix.UnixFileSystemInfo.AssertValid","level":0,"line":0},{"assembly":"Microsoft.Azure.WebJobs.Script, Version=4.21.0.0, Culture=neutral, PublicKeyToken=null","method":"Microsoft.Azure.WebJobs.Script.Workers.Http.HttpWorkerProcess.AssignUserExecutePermissionsIfNotExists","level":1,"line":75,"fileName":"/src/azure-functions-host/src/WebJobs.Script/Workers/Http/HttpWorkerProcess.cs"}]}] | exception | {"LogLevel":"Warning","HostInstanceId":"c2dec006-544d-42f4-a414-30d2284fbb09","prop__{OriginalFormat}":"Error while assigning execute permission.","FormattedMessage":"Error while assigning execute permission.","Category":"Worker.HttpWorkerProcess.73289973-619c-47ea-9d70-f8e2c6e19e1e","ProcessId":"62"} | | | | | | | | | | | PC | | | 0.0.0.0 | | | | | jobcenter-dev-frontend-staticapp | 4A88A912-638222609978723514 | 7c2e2e88-d2aa-4e78-83c0-9b51e11f7916 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins | 0c9d1bfe-8d84-4e71-a335-b57a81ba02ea | azurefunctions: 4.21.3.3 | 8c24b4e7-09f2-11ee-a66a-6045bd946746 | 1 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins |
13/06/2023, 13:44:46.730 | System.InvalidOperationException at Mono.Unix.UnixFileSystemInfo.AssertValid | | System.InvalidOperationException | | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | System.InvalidOperationException | Path doesn't exist! | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | | | | | 2 | [{"severityLevel":"Warning","outerId":"0","message":"Path doesn't exist!","type":"System.InvalidOperationException","id":"28777946","parsedStack":[{"assembly":"Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","method":"Mono.Unix.UnixFileSystemInfo.AssertValid","level":0,"line":0},{"assembly":"Microsoft.Azure.WebJobs.Script, Version=4.21.0.0, Culture=neutral, PublicKeyToken=null","method":"Microsoft.Azure.WebJobs.Script.Workers.Http.HttpWorkerProcess.AssignUserExecutePermissionsIfNotExists","level":1,"line":75,"fileName":"/src/azure-functions-host/src/WebJobs.Script/Workers/Http/HttpWorkerProcess.cs"}]}] | exception | {"prop__{OriginalFormat}":"Error while assigning execute permission.","LogLevel":"Warning","FormattedMessage":"Error while assigning execute permission.","Category":"Worker.HttpWorkerProcess.dac2ca4a-181f-4f77-808b-08cbfe230ec5","HostInstanceId":"33c052b9-61bb-4ee4-9662-d9b6a7c91ac6","ProcessId":"59"} | | | | | | | | | | | PC | | | 0.0.0.0 | | | | | jobcenter-dev-frontend-staticapp | 4A88A912-638222583963888914 | 7c2e2e88-d2aa-4e78-83c0-9b51e11f7916 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins | 0c9d1bfe-8d84-4e71-a335-b57a81ba02ea | azurefunctions: 4.21.3.3 | 9452f6a4-09f0-11ee-a66c-6045bd950b83 | 1 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins |
13/06/2023, 13:44:56.464 | System.InvalidOperationException at Mono.Unix.UnixFileSystemInfo.AssertValid | | System.InvalidOperationException | | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | System.InvalidOperationException | Path doesn't exist! | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | | | | | 2 | [{"severityLevel":"Warning","outerId":"0","message":"Path doesn't exist!","type":"System.InvalidOperationException","id":"31103067","parsedStack":[{"assembly":"Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","method":"Mono.Unix.UnixFileSystemInfo.AssertValid","level":0,"line":0},{"assembly":"Microsoft.Azure.WebJobs.Script, Version=4.21.0.0, Culture=neutral, PublicKeyToken=null","method":"Microsoft.Azure.WebJobs.Script.Workers.Http.HttpWorkerProcess.AssignUserExecutePermissionsIfNotExists","level":1,"line":75,"fileName":"/src/azure-functions-host/src/WebJobs.Script/Workers/Http/HttpWorkerProcess.cs"}]}] | exception | {"Category":"Worker.HttpWorkerProcess.faefa5ac-ba16-446a-9f14-468ca2a7b5ff","ProcessId":"58","HostInstanceId":"a3472b28-08ac-4c93-987d-170c03e234aa","FormattedMessage":"Error while assigning execute permission.","LogLevel":"Warning","prop__{OriginalFormat}":"Error while assigning execute permission."} | | | | | | | | | | | PC | | | 0.0.0.0 | | | | | jobcenter-dev-frontend-staticapp | 4A88A912-638222590002844309 | 7c2e2e88-d2aa-4e78-83c0-9b51e11f7916 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins | 0c9d1bfe-8d84-4e71-a335-b57a81ba02ea | azurefunctions: 4.21.3.3 | a02c2ca4-09f0-11ee-a66a-6045bd946a31 | 1 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins |
13/06/2023, 13:45:42.799 | System.InvalidOperationException at Mono.Unix.UnixFileSystemInfo.AssertValid | | System.InvalidOperationException | | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | System.InvalidOperationException | Path doesn't exist! | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | | | | | 2 | [{"severityLevel":"Warning","outerId":"0","message":"Path doesn't exist!","type":"System.InvalidOperationException","id":"62465700","parsedStack":[{"assembly":"Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","method":"Mono.Unix.UnixFileSystemInfo.AssertValid","level":0,"line":0},{"assembly":"Microsoft.Azure.WebJobs.Script, Version=4.21.0.0, Culture=neutral, PublicKeyToken=null","method":"Microsoft.Azure.WebJobs.Script.Workers.Http.HttpWorkerProcess.AssignUserExecutePermissionsIfNotExists","level":1,"line":75,"fileName":"/src/azure-functions-host/src/WebJobs.Script/Workers/Http/HttpWorkerProcess.cs"}]}] | exception | {"HostInstanceId":"8eee856f-8a54-479f-af79-a2779c74a79d","prop__{OriginalFormat}":"Error while assigning execute permission.","ProcessId":"67","Category":"Worker.HttpWorkerProcess.3d2d759a-e5cf-4a49-a5dd-041bb768928e","LogLevel":"Warning","FormattedMessage":"Error while assigning execute permission."} | | | | | | | | | | | PC | | | 0.0.0.0 | | | | | jobcenter-dev-frontend-staticapp | 4A88A912-638222578565922633 | 7c2e2e88-d2aa-4e78-83c0-9b51e11f7916 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins | 0c9d1bfe-8d84-4e71-a335-b57a81ba02ea | azurefunctions: 4.21.3.3 | b80aa546-09f0-11ee-a66c-6045bd950a61 | 1 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins |
13/06/2023, 13:45:54.925 | System.InvalidOperationException at Mono.Unix.UnixFileSystemInfo.AssertValid | | System.InvalidOperationException | | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | System.InvalidOperationException | Path doesn't exist! | Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | Mono.Unix.UnixFileSystemInfo.AssertValid | | | | | 2 | [{"severityLevel":"Warning","outerId":"0","message":"Path doesn't exist!","type":"System.InvalidOperationException","id":"38700158","parsedStack":[{"assembly":"Mono.Posix.NETStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51","method":"Mono.Unix.UnixFileSystemInfo.AssertValid","level":0,"line":0},{"assembly":"Microsoft.Azure.WebJobs.Script, Version=4.21.0.0, Culture=neutral, PublicKeyToken=null","method":"Microsoft.Azure.WebJobs.Script.Workers.Http.HttpWorkerProcess.AssignUserExecutePermissionsIfNotExists","level":1,"line":75,"fileName":"/src/azure-functions-host/src/WebJobs.Script/Workers/Http/HttpWorkerProcess.cs"}]}] | exception | {"HostInstanceId":"bf64cc40-9630-407d-854b-e6196ec2bbbb","ProcessId":"56","LogLevel":"Warning","FormattedMessage":"Error while assigning execute permission.","prop__{OriginalFormat}":"Error while assigning execute permission.","Category":"Worker.HttpWorkerProcess.6347f010-0e0b-49cd-b3f3-eba65aac70b7"} | | | | | | | | | | | PC | | | 0.0.0.0 | | | | | jobcenter-dev-frontend-staticapp | 4A88A912-638222594939805991 | 7c2e2e88-d2aa-4e78-83c0-9b51e11f7916 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins | 0c9d1bfe-8d84-4e71-a335-b57a81ba02ea | azurefunctions: 4.21.3.3 | bec1324f-09f0-11ee-a66a-6045bd91b670 | 1 | /subscriptions/8e9f4642-3c29-454c-afd9-bd5faca28617/resourcegroups/jobcenter-dev-rg/providers/microsoft.insights/components/jobcenter-dev-appins |
**To Reproduce**
Steps to reproduce the behavior:
1. Create a next.js app using create-next-app@latest
2. Add next-auth with Azure AD B2C as provider
3. Create any API endpoint in the /app/api folder
4. See error
I can share the repository and azure config and pipeline files in private
**Expected behavior**
The app running and receiving requests in the API
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.