Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] provide the platform request object #2359

Closed
wants to merge 1 commit into from
Closed

Conversation

benmccann
Copy link
Member

There are some things that are not possible to do today that this will enable. E.g. if you use adapter-node's Kit middleware with a custom server and add some other middleware that populates a custom property onto the request then you have no way to access that today.

@changeset-bot
Copy link

changeset-bot bot commented Sep 3, 2021

🦋 Changeset detected

Latest commit: 911b5b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@sveltejs/adapter-netlify Patch
@sveltejs/adapter-node Patch
@sveltejs/adapter-vercel Patch
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@benbender
Copy link

Halleluja! \o/ :)

@Rich-Harris
Copy link
Member

I think we need to tread very carefully here, and consider what this looks like in non-Node-like environments, and how it affects other things. For example https://kit.svelte.dev/faq#how-do-i-use-x-with-sveltekit-how-do-i-use-middleware makes me nervous (the fact that you need to specify middleware both in your custom server and in your config); to me this feels like a symptom of a design that isn't fully baked.

At the very least, platformReq probably isn't the right name given that Lambdas and Cloudflare Workers etc refer to 'events' rather than 'requests'.

@benmccann
Copy link
Member Author

benmccann commented Sep 6, 2021

For example https://kit.svelte.dev/faq#how-do-i-use-x-with-sveltekit-how-do-i-use-middleware makes me nervous (the fact that you need to specify middleware both in your custom server and in your config); to me this feels like a symptom of a design that isn't fully baked.

Yeah, I agree with this. In the meantime I figured I'd at least document what's possible at the moment to unblock folks who need the functionality even if it's not ideal. Though that seems like somewhat of a separate issue?

At the very least, platformReq probably isn't the right name given that Lambdas and Cloudflare Workers etc refer to 'events' rather than 'requests'.

Any other suggestions? Even if those platforms use the word events to refer to requests, they're still requests. I think the folks using those platforms are unlikely to be confused and they're probably pretty unlikely to need to use it anyway

@benmccann
Copy link
Member Author

Talked about this in today's maintainer's meeting. Rich suggested we provide a way to put stuff from the original request into locals instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants