@@ -4,6 +4,7 @@ import type { RequestStore } from '../../client/components/request-async-storage
4
4
import type { AppRenderContext , GenerateFlight } from './app-render'
5
5
import type { AppPageModule } from '../../server/route-modules/app-page/module'
6
6
import type { BaseNextRequest , BaseNextResponse } from '../base-http'
7
+ import type { RequestErrorContext } from '../instrumentation/types'
7
8
8
9
import {
9
10
RSC_HEADER ,
@@ -403,6 +404,7 @@ type ServerActionsConfig = {
403
404
export async function handleAction ( {
404
405
req,
405
406
res,
407
+ errorContext,
406
408
ComponentMod,
407
409
serverModuleMap,
408
410
generateFlight,
@@ -413,6 +415,10 @@ export async function handleAction({
413
415
} : {
414
416
req : BaseNextRequest
415
417
res : BaseNextResponse
418
+ errorContext : Pick <
419
+ RequestErrorContext ,
420
+ 'routerKind' | 'routePath' | 'routeType'
421
+ >
416
422
ComponentMod : AppPageModule
417
423
serverModuleMap : ServerModuleMap
418
424
generateFlight : GenerateFlight
@@ -539,7 +545,7 @@ export async function handleAction({
539
545
540
546
return {
541
547
type : 'done' ,
542
- result : await generateFlight ( ctx , {
548
+ result : await generateFlight ( req , ctx , errorContext , {
543
549
actionResult : promise ,
544
550
// if the page was not revalidated, we can skip the rendering the flight tree
545
551
skipFlight : ! staticGenerationStore . pathWasRevalidated ,
@@ -817,7 +823,7 @@ export async function handleAction({
817
823
requestStore,
818
824
} )
819
825
820
- actionResult = await generateFlight ( ctx , {
826
+ actionResult = await generateFlight ( req , ctx , errorContext , {
821
827
actionResult : Promise . resolve ( returnVal ) ,
822
828
// if the page was not revalidated, or if the action was forwarded from another worker, we can skip the rendering the flight tree
823
829
skipFlight :
@@ -895,7 +901,7 @@ export async function handleAction({
895
901
}
896
902
return {
897
903
type : 'done' ,
898
- result : await generateFlight ( ctx , {
904
+ result : await generateFlight ( req , ctx , errorContext , {
899
905
skipFlight : false ,
900
906
actionResult : promise ,
901
907
asNotFound : true ,
@@ -928,7 +934,7 @@ export async function handleAction({
928
934
929
935
return {
930
936
type : 'done' ,
931
- result : await generateFlight ( ctx , {
937
+ result : await generateFlight ( req , ctx , errorContext , {
932
938
actionResult : promise ,
933
939
// if the page was not revalidated, or if the action was forwarded from another worker, we can skip the rendering the flight tree
934
940
skipFlight :
0 commit comments