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

introduce cloudflare platform object containing all the cloudflare context relative to the request #233

Closed

Conversation

dario-piotrowicz
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented May 11, 2023

🦋 Changeset detected

Latest commit: e0cc582

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

This PR includes changesets to release 1 package
Name Type
@cloudflare/next-on-pages Major

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

Copy link
Member

@GregBrimble GregBrimble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should move env away from process.env. This means apps won't "just work" when deployed to Pages.

I'm not sold on cf or ctx either, but don't really have any meaningfully different ideas for those.

@dario-piotrowicz
Copy link
Member Author

I don't think we should move env away from process.env. This means apps won't "just work" when deployed to Pages.

ah.... I guess for env you do have a point 😕

I'm not sure what you don't like about cf and ctx 😢 (we should however have a way to expose them to the users)
we could also move them directly into the process.env but I am afraid of name conflicts (unless we call them something else)

@dario-piotrowicz
Copy link
Member Author

After discussing it offline with @GregBrimble we decided to try something different, so I am closing this PR

@dario-piotrowicz dario-piotrowicz deleted the cloudflare-platform branch May 12, 2023 11:55
@shiqimei
Copy link

shiqimei commented Aug 17, 2023

I don't think we should move env away from process.env. This means apps won't "just work" when deployed to Pages.

ah.... I guess for env you do have a point 😕

I'm not sure what you don't like about cf and ctx 😢 (we should however have a way to expose them to the users) we could also move them directly into the process.env but I am afraid of name conflicts (unless we call them something else)

Yeah, why hide cf from users? I think this implementation is more simple and elegant than #265 . We actually can avoid the breaking change (keep spreading cloudflare env to process.env).

This our fork version askcodebase@5e6c412 and we released our self-maintained package @askcodebase/next-on-pages to make this feature possible.

@dario-piotrowicz can you propose this topic again and discuss with your colleagues ? The community do need this feature. Thx!

@dario-piotrowicz
Copy link
Member Author

@shiqimei thank you for your comment 🙂

I will bring this to the team and see if we can decide, it does sound like it would be a valuable change (especially for now and we can change things later in a major version if need be)

One small thing to note is that your solution does introduce a sort of breaking change because if users has a binding called CloudflareContext it would get overridden by yours... but yeah that sounds extremely unlikely so maybe it's something that can be overlooked...


Regarding why we haven't yet implemented a solution, that's only because we've been trying to decide on an agnostic solution that could be applied generally by anyone using Cloudflare workers/pages, we have some ideas but it's taking quite some time since different teams are involved, truthfully I need to chase that up!
Anyways as I said we could go with a temporary solution anyways now and revert it in a major maybe... let me check with the team and come back to you 👍

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