-
Notifications
You must be signed in to change notification settings - Fork 8
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
I can build my app but it throws error during preview testing (pnpm run preview:worker) #78
Comments
pnpm run preview:worker
)
pnpm run preview:worker
)
Any update on this @vicb? Any insight would be greatly appreciated. So that I can decide if this is the direction to go or not. Thanks :) |
Hey @shashankboosi , As of today However the team is dedicated and hard at work to make the cloudflare adapter more reliable. We are working on improving the cloudflare adapter itself, the compatibility with Node.js, and the tooling. That's a lot of work but we will get there. On the adapter side, @mhart was able to get PPR to work on workers. We also want to re-use the awesome work @conico974 , @khuezy, and others have put into Sharing code with other members of OpenNEXT will allow us to catch up with their level of support. It also means that a fix or a feature contributed to the common code will benefit all of us. That's the power of open source! Integrating more deeply with OpenNEXT will also enable users to deploy part of their apps to different platforms. For example you will be able to deploy most of your app to cloudfare workers and a the few routes needing Node.js to AWS or any other serverless platform. The future is exciting but we need a little bit of time ;) |
Hey @vicb, Thanks for getting back on this! I am glad you guys are pushing hard on the adapter, and deeply integrating with OpenNext. I am looking forward to see all of this come to life as it will help a lot more developers to integrate with Cloudflare. I would have happily contributed to this if I had more context on the exact problem and places to look at on the AWS side of OpenNEXT to integrate it on the Cloudflare side but I guess you guys might be more equipped for this :) I am hoping to reach MVP for the project by the end of year, so fingers crossed on where I might deploy ;) |
We would be delighted to get some contributors. We will share what we have as soon as possible (days) so that contributors can help us - we'll probably create "Help Wanted" issues for contributors to pick at that point. |
Hey @vicb, I had a bit of time today and I decided to investigate the codebase to understand and also try to see if a fix for the above issue can be found :) I believe the reason for the error lies in the fact that, currently all the requests in the workers go through The response doesn't handle cookies as there is a bit of a difference in the way cookies are handled on cf workers as seen here. I checked my headers and the encodings are compressed. I checked the aws repo for it and they do something like that for their lambda env as seen at I believe if the compression streams are implemented and handled within that fetch handler along with cookies. The issue that I am facing might be fixed. Posting this so that it might help you guys as I believe there is still a bit of a knowledge gap for me to implement it myself given that I had zero idea about this work till last week. I hope this helps you guys or anyone working on the fetch handler. Correct me if I am wrong on any of this hehe Thanks :) |
Hello,
Thanks for your work on supporting Next.js with Cloudflare workers.
Here is some information about my application, I am using Next.js 14.2.3 but the API routes are handled by
Hono.js
and my authentication also happens on the server side.The application works fine while developing withnext dev
andnext build
.I followed all the steps from here on an already existing app to see if cf workers could be an option for deployment but the preview testing(
pnpm run preview:worker
) fails when I try to redirect my application from an auth provider after authentication back into my dashboard. Here is the error that I getHere is the api routes(route.ts) entry point where hono.js is used instead of next.js
Path:
app/api/[[...route]]/route.ts
I am using Kinde as my auth provider. Here is the Kinde config
Path:
app/api/[[...route]]/kinde.ts
and I have configured my logic on the authRoute
Path:
app/api/[[...route]]/auth.ts
The error mainly occurs in the callback get endpoint and it throws 500 Internal Server error with the error mentioned on the top.
One weird thing that I noticed is that the callback url on the browser is different to when I printed it on the server in the endpoint. It shows as follows
http://n/api/callback?code=<code_placeholder>&scope=openid%20profile%20email%20offline&state=ceee3598cfc87428e886232a574a
. Thelocalhost:8771
becomesn
on the server log, I hope that helps.This is my wrangler.toml:
As I said, this error happened when I started using cloudflare workers preview to see if it is viable for deploying the application. If you can help me find the root cause of this. That would be great as I was potentially considering Cloudflare for my app deployment.
Thanks :)
The text was updated successfully, but these errors were encountered: