Example of code / use cases for potential updates to SvelteKit Netlify Adapter.
- Details at Github Issue
- Demo
Current Netlify Adapter has 2 primary limitations:
- Endpoints do not have access to
context.clientContext
data. This contains information needed to interact with services like Netlify Identity for admin actions. Details - Netlify triggers some functionality per specifically named functions (e.g. post user signup). Endpoint 'functions' are currently aggregated into a single
render
function, preventing specifically named endpoints/functions from being available post build. Details
- For functionality that requires
context.clientContext
data, create a separate, custom serverless function that is copied post build into the finalfunctions
directory (via package.json script):- Example 1:
/src/additional_functions/delete-identity.js
(a function called explicitly by SK endpoints) - Example 2:
/src/additional_functions/handle-subscription-change.js
(a webhook triggered by an external event [Stripe subscription udpate])
- Example 1:
- For specifically named files that are triggered by events, also create a separate custom serverless function that is copied post build into the final
functions
directory:- Example:
/src/additional_functions/identity-signup.js
(function called automatically when a new user completes signup process)
- Example:
- @sveltejs/kit 1.0.0-next.115
- @sveltejs/adapter-netlify 1.0.0-next.17
- Create accounts if needed; can use free plan for all.
-
Install Netlify CLI
-
Clone repo & publish within own Git account