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(hono): enable context storage #891

Merged
merged 1 commit into from
Sep 19, 2024
Merged

feat(hono): enable context storage #891

merged 1 commit into from
Sep 19, 2024

Conversation

dai-shi
Copy link
Owner

@dai-shi dai-shi commented Sep 18, 2024

Instead of #852 and #884, let's use Hono's getContext instead.

Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Sep 18, 2024 1:11pm

Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@rmarscher
Copy link
Contributor

rmarscher commented Sep 18, 2024

When testing this, I receive the "Context is not available" error when trying to access the hono context within a server component.

I was able to figure out a way to update the dev server plugin to work with the hono context. It is available there. I'm not so sure about this solution with the waku middleware... I have to reconstruct the hono app to pass the updated env and ctx to the fetch handler. The hono context is immutable once created. https://gist.github.com/rmarscher/9bb6ed54dc9535f4b81bed147204c7e9

Hono has an adapter system for their vite plugin. The cloudflare adapter returns the env and executionContext and they mix that in when invoking fetch: https://github.com/honojs/vite-plugins/blob/main/packages/dev-server/src/dev-server.ts#L124-L137

I created a new PR with a new fetch adapter option for the dev server. I think this will be much more user-friendly for cloudflare devs than copy and pasting a custom plugin. #892

@dai-shi dai-shi marked this pull request as ready for review September 19, 2024 00:49
@dai-shi
Copy link
Owner Author

dai-shi commented Sep 19, 2024

Assuming this PR itself is fine, let's merge.

@dai-shi dai-shi merged commit 86abc76 into main Sep 19, 2024
28 checks passed
@dai-shi dai-shi deleted the feat/hono/context branch September 19, 2024 00:57
This was referenced Sep 19, 2024
dai-shi added a commit that referenced this pull request Sep 19, 2024
dai-shi added a commit that referenced this pull request Sep 24, 2024
#891 and #894 weren't working correctly with deploys.
dai-shi added a commit that referenced this pull request Sep 28, 2024
at least for now. this reverts #891 and re-introduce #852 and #884.

#911 (comment)
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.

2 participants