svelte-adapter-azure-swa
svelte-adapter-azure-swa copied to clipboard
Server-side API doesn't support additional HTTP methods
When implementing server functions in SvelteKit, it seems like only the standard HTTP GET and POST methods are supported. Any other method (e.g. PATCH) returns HTTP 405. There seems to be nothing in the adapter documentation concerning this issue, or how to configure the settings to allow for other methods. Experimenting with various route options in adapter config either yielded no results, or straight up broke the server side completely. But it may just be that I'm missing something obvious.
I have not tested the new verion of the adapter, supporting v4 for azure functions.
Previously it was possible to apply this in the svelte config:
azure({ customStaticWebAppConfig: { platform: { apiRuntime: 'node:18' }, routes: [ { route: '/data/*', methods: ['GET', 'DELETE', 'PATCH', 'POST', 'PUT'], rewrite: '/api/__render' } ] } })
This was due to the fact that /api/ is used by SWA and azure function, and we renamed +server.ts routes to have the path /data/.
If this is possible on Azure function v4, I do no know.
Added support for PATCH in adapter version 0.22.1. GET, POST, PUT, and DELETE were already supported, and now we have Playwright tests checking those.