Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Expose event and context of Netlify Function in Next.js pages and API routes #119

Merged
merged 5 commits into from
Dec 22, 2020

Commits on Dec 14, 2020

  1. Netlify function template: Remove requestContext object

    This object is not needed on Netlify. It is a relict of next-aws-lambda.
    FinnWoelm committed Dec 14, 2020
    Configuration menu
    Copy the full SHA
    1e35de0 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2020

  1. Expose event + context of Netlify Functions on the req object

    When a page is being SSR-ed by a Netlify Function, allow users to access
    the function's event and context parameters. These can be accessed as
    a property on the `req` object in all SSR-ed pages and in API routes:
    - req.netlifyFunction.event
    - req.netlifyFunction.context
    
    This allows users to access/leverage Netlify identity for their Next.js
    page.
    See: #20
    
    It also allows users to modify the callbackWaitsForEmptyEventLoop
    behavior.
    See: #66 (comment))
    FinnWoelm committed Dec 15, 2020
    Configuration menu
    Copy the full SHA
    c537545 View commit details
    Browse the repository at this point in the history
  2. Cypress: Test that user can modify callbackWaitsForEmptyEventLoop

    Test that users can modify the Netlify Function's
    callbackWaitsForEmptyEventLoop behavior via the newly exposed function
    event and context objects. When callbackWaitsForEmptyEventLoop is true
    (default), the function does not finish until all async processes and
    timeouts are completed (or cleared). The user can set this to false to
    not wait for other processes to finish.
    FinnWoelm committed Dec 15, 2020
    Configuration menu
    Copy the full SHA
    356046e View commit details
    Browse the repository at this point in the history
  3. README: Explain how to use Netlify Identity with next-on-netlify

    Add instructions, details, and an example for using Netlify Identity 
    with next-on-netlify.
    FinnWoelm committed Dec 15, 2020
    Configuration menu
    Copy the full SHA
    1ba11f8 View commit details
    Browse the repository at this point in the history

Commits on Dec 19, 2020

  1. Expose netlifyFunction params as netlifyFunctionParams

    Expose event and context of Netlify Function in Next.js pages and API
    routes as `netlifyFunctionParams` (rather than `netlifyFunction`).
    The new name is clearer, since we're just making the parameters of the
    function available and not the function itself.
    FinnWoelm committed Dec 19, 2020
    Configuration menu
    Copy the full SHA
    5fa6c5a View commit details
    Browse the repository at this point in the history