Skip to content

Commit

Permalink
Remove the Nelify Edge adapter (#8029)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored Aug 10, 2023
1 parent 9cc4e48 commit 2ee418e
Show file tree
Hide file tree
Showing 28 changed files with 27 additions and 543 deletions.
23 changes: 23 additions & 0 deletions .changeset/tame-files-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'@astrojs/netlify': major
---

Remove the Netlify Edge adapter

`@astrojs/netlify/functions` now supports Edge middleware, so a separate adapter for Edge itself (deploying your entire app to the edge) is no longer necessary. Please update your Astro config to reflect this change:

```diff
// astro.config.mjs
import { defineConfig } from 'astro/config';
- import netlify from '@astrojs/netlify/edge';
+ import netlify from '@astrojs/netlify/functions';

export default defineConfig({
output: 'server',
adapter: netlify({
+ edgeMiddleware: true
}),
});
```

This adapter had several known limitations and compatibility issues that prevented many people from using it in production. To reduce maintenance costs and because we have a better story with Serveless + Edge Middleware, we are removing the Edge adapter.
26 changes: 4 additions & 22 deletions packages/integrations/netlify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,11 @@ If you prefer to install the adapter manually instead, complete the following tw
});
```
### Edge Functions
Netlify has two serverless platforms, [Netlify Functions](https://docs.netlify.com/functions/overview/) and [Netlify Edge Functions](https://docs.netlify.com/edge-functions/overview/). With Edge Functions your code is distributed closer to your users, lowering latency.
To deploy with Edge Functions, use `netlify/edge-functions` in the Astro config file instead of `netlify/functions`.
```js ins={3}
// astro.config.mjs
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/edge-functions';
export default defineConfig({
output: 'server',
adapter: netlify(),
});
```
### Run middleware in Edge Functions
When deploying to Netlify Functions, you can choose to use an Edge Function to run your Astro middleware.
To enable this, set the `build.excludeMiddleware` Astro config option to `true`:
To enable this, set the `edgeMiddleware` config option to `true`:
```js ins={9}
// astro.config.mjs
Expand All @@ -85,10 +68,9 @@ import netlify from '@astrojs/netlify/functions';
export default defineConfig({
output: 'server',
adapter: netlify(),
build: {
excludeMiddleware: true,
},
adapter: netlify({
edgeMiddleware: true,
}),
});
```
Expand Down
1 change: 0 additions & 1 deletion packages/integrations/netlify/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { netlifyEdgeFunctions } from './integration-edge-functions.js';
export { netlifyFunctions as default, netlifyFunctions } from './integration-functions.js';
export { netlifyStatic } from './integration-static.js';
98 changes: 0 additions & 98 deletions packages/integrations/netlify/src/integration-edge-functions.ts

This file was deleted.

34 changes: 0 additions & 34 deletions packages/integrations/netlify/src/netlify-edge-functions.ts

This file was deleted.

11 changes: 0 additions & 11 deletions packages/integrations/netlify/test/edge-functions/deps.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2ee418e

Please sign in to comment.