Comments (6)
What are you using platform
for? It's only defined for edge functions, because its only member, context
, is only available within edge functions (settable through the runtime
adapter option). The only member of context
is waitUntil
, which you can now import directly in both edge and serverless functions: https://vercel.com/changelog/waituntil-is-now-available-for-vercel-functions
@Rich-Harris should we "shim" this for serverless, by passing along a "fake" context on which we provide the waitUntil
method? I tend towards "no, use the package Vercel provides directly". If you're using platform
you're already provider-specific.
from kit.
Ok, so the recommended approach is to import it from here import { waitUntil } from '@vercel/functions'?
Exactly
I'm not sure why, but I was under the impression that such thing should live on the "platform"
platform
is more for things that are per-request and coming from the underlying platform. But yeah it's not very strict what's coming from where. In this case, since Vercel provides it, it's better to use the package directly.
For consistency it might even be better to remove it from edge functions? (deprecate with warning first, obvs)
Makes sense
from kit.
What are you using
platform
for? It's only defined for edge functions, because its only member,context
, is only available within edge functions. The only member ofcontext
iswaitUntil
, which you can now import directly in both edge and serverless functions: https://vercel.com/changelog/waituntil-is-now-available-for-vercel-functions@Rich-Harris should we "shim" this for serverless, by passing along a "fake" context on which we provide the
waitUntil
method? I tend towards "no, use the package Vercel provides directly". If you're usingplatform
you're already provider-specific.
It was exactly waitUntil
. Ok, so the recommended approach is to import it from here import { waitUntil } from '@vercel/functions'
?
I'm not sure why, but I was under the impression that such thing should live on the "platform", but importing from @vercel/functions
would also be ok.
from kit.
I tend towards "no, use the package Vercel provides directly"
I lean the same way - it would just add code to people's bundles if they weren't using it. For consistency it might even be better to remove it from edge functions? (deprecate with warning first, obvs)
from kit.
Isn't it already populated here?
kit/packages/adapter-vercel/files/edge.js
Lines 13 to 24 in f67898d
The ambient type for it exists too although it's not correctly included when importing the adapter at the moment.
kit/packages/adapter-vercel/ambient.d.ts
Lines 1 to 12 in f67898d
Or am I mistaken and thinking of something entirely different?
from kit.
It's there, but it's only set for edge functions, not serverless functions, hence the confusion and thought to remove the context for edge, since it only contains waitUntil
. Argument against it is that at some point in the future there might be other things on the context object and we would go adding it back in again - which makes me think we just leave everything as is and close this issue.
from kit.
Related Issues (20)
- Docs: Copy Button for some code samples has typescript errors copied to clipboard HOT 1
- Improve scss compile speed HOT 6
- server functions HOT 3
- Identical Code Builds on Linux and Fails on Windows
- url.searchParams showing as empty HOT 1
- svelte 5: @html does not rerender with $effect.pre
- removed export from MaybePromise in downloaded package from NPM HOT 3
- CSP types are no longer exported from SvelteKit package from version 2.5.25 HOT 2
- Update wrangler dependency used by `@sveltejs/adapter-cloudflare` HOT 3
- Custom Loggers for Adapters
- Import universal `fetch` to use from `lib` HOT 1
- Typed API Routes HOT 1
- Improve `adapter-cloudflare`'s exclusion logic for prerendered paths HOT 1
- "Use `{@render ...}` tags instead" warning when forcing runes mode
- Should parent() call parent load functions by default ? HOT 12
- Allow having client-only `load` HOT 6
- Option to disable or configure `svelte-announcer`
- Very large (500mb+) file request body null
- CSS style broken during client side rendering
- `mousemove` event listener is being attached in setup_preload even if I am not using `data-sveltekit-preload-[x]="hover"`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kit.