You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, it's impossible to aggregate next server action information in middleware outside of the next-action header, which specifies the action id. This makes it difficult to conduct server action middleware logging.
The request in middleware exposes next-action as well as the payload, which can be important for debugging. Including a next-action-name could further help debugging and bring logging on par with what we'd expect from traditional restful design patterns.
I understand a log can be added into the function itself. This is great, but it's not as convenient and more error-prone than handling the identification of the function and its params in the middleware.
Non-Goals
No response
Background
This feature is needed to increase the convenience of middleware-based logging. If you design your app to use server actions instead of api endpoints, you lose the ease of consistent logging.
In documentation, it makes it very clear that server actions are meant to be public endpoints. I expect public endpoints to have their route exposed to the public..including the function name aligns with that model.
Proposal
When generating action ids, we should store the function name alongside as well. We should add a header next-action-name that would carry the function name so that it can be used in middleware.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Currently, it's impossible to aggregate next server action information in
middleware
outside of thenext-action
header, which specifies the action id. This makes it difficult to conduct server action middleware logging.The request in middleware exposes
next-action
as well as thepayload
, which can be important for debugging. Including anext-action-name
could further help debugging and bring logging on par with what we'd expect from traditional restful design patterns.I understand a log can be added into the function itself. This is great, but it's not as convenient and more error-prone than handling the identification of the function and its params in the middleware.
Non-Goals
No response
Background
This feature is needed to increase the convenience of middleware-based logging. If you design your app to use server actions instead of api endpoints, you lose the ease of consistent logging.
In documentation, it makes it very clear that server actions are meant to be public endpoints. I expect public endpoints to have their route exposed to the public..including the function name aligns with that model.
Proposal
When generating action ids, we should store the function name alongside as well. We should add a header
next-action-name
that would carry the function name so that it can be used in middleware.Beta Was this translation helpful? Give feedback.
All reactions