Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop the experimental env var for onRequestError API #67856

Merged
merged 6 commits into from
Jul 17, 2024

Commits on Jul 17, 2024

  1. Configuration menu
    Copy the full SHA
    a5a6186 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    51cd846 View commit details
    Browse the repository at this point in the history
  3. set page to dynamic

    huozhi committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    af3b329 View commit details
    Browse the repository at this point in the history
  4. drop the experimental env var

    huozhi committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    2013224 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8f08c7c View commit details
    Browse the repository at this point in the history
  6. Expose TS type for onRequestError (#67859)

    ## What
    
    Expose the TS types for onRequestError API
    
    ### API
    ```ts
    type RequestErrorContext = {
        routerKind: 'Pages Router' | 'App Router';
        routePath: string;
        routeType: 'render' | 'route' | 'action' | 'middleware';
        renderSource?: 'react-server-components' | 'react-server-components-payload' | 'server-rendering';
    };
    
    export declare namespace Instrumentation {
        type onRequestError = (error: unknown, errorRequest: Readonly<{
        method: string;
        url: string;
        headers: NodeJS.Dict<string | string[]>;
    }>, errorContext: Readonly<RequestErrorContext>) => void | Promise<void>;
    ```
    
    ### Usage
    
    ```ts
    // instrumentation.ts
    import { type Instrumentation } from 'next'
    
    export const onRequestError: Instrumentation.onRequestError = (
      err,
      request,
      context
    ) => {
      //...
    }
    ```
    huozhi committed Jul 17, 2024
    Configuration menu
    Copy the full SHA
    517f0e0 View commit details
    Browse the repository at this point in the history