next-on-pages icon indicating copy to clipboard operation
next-on-pages copied to clipboard

[🐛 Bug]: Using `redirect` in actions causes errors in `wrangler pages dev`

Open dario-piotrowicz opened this issue 1 year ago • 7 comments

next-on-pages environment related information

System:
        Platform: darwin
        Arch: arm64
        Version: Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:43 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6000
        CPU: (10) arm64 Apple M1 Pro
        Memory: 32 GB
        Shell: /bin/zsh
Package Manager Used: npm (10.2.4)

Relevant Packages:
        @cloudflare/next-on-pages: 1.11.0
        vercel: 33.6.1
        next: 14.1.0

Description

Using the Next.js' built-in redirect method in server actions seems to break wrangler pages dev

Thankfully the issue doesn't appear in the deployed application

Reproduction

https://github.com/dario-piotrowicz/next-on-pages-redirect-issue-repro

Additional Information

This seems likely to me a wrangler issue, we should likely move it to the workers-sdk repository, I am adding it here just to keep track of it and investigate it further, it should be moved to workers-sdk if it ends up actually being a wrangler specific issue

dario-piotrowicz avatar Mar 27 '24 23:03 dario-piotrowicz

@dario-piotrowicz any updates on this issue?

yusuf8ahmed avatar Mar 14 '25 07:03 yusuf8ahmed

Hi @yusuf8ahmed 🙂

Sorry no updates, actually next-on-pages is a bit in maintenance mode right now (and I am not actively working on it) and official efforts from the Cloudflare team have been shifted onto our open-next adapter: https://github.com/opennextjs/opennextjs-cloudflare have you tried that by any chance?

dario-piotrowicz avatar Mar 14 '25 21:03 dario-piotrowicz

Hi @dario-piotrowicz

I am planning on moving to opennextjs-cloudflare but I'm worried since it not ready for production yet. Is there anything that I could do as a stop gap solution?

yusuf8ahmed avatar Mar 16 '25 05:03 yusuf8ahmed

Also off topic question, If I can't use redirect in wrangler pages dev. How would KV work when using next dev, Currently for D1 I am using a work around where I point to a local db when running next dev?

yusuf8ahmed avatar Mar 16 '25 07:03 yusuf8ahmed

Hi @dario-piotrowicz

I am planning on moving to opennextjs-cloudflare but I'm worried since it not ready for production yet. Is there anything that I could do as a stop gap solution?

I'm sorry unfortunately I don't think there is a stop gap solution right now 😓

dario-piotrowicz avatar Mar 17 '25 00:03 dario-piotrowicz

Also off topic question, If I can't use redirect in wrangler pages dev. How would KV work when using next dev, Currently for D1 I am using a work around where I point to a local db when running next dev?

Sorry I'm not completely sure I follow the question 😕 Are you asking how to use production values when running your application locally? (if that's the question, we don't currently have a solution for that but the team is working on one 🥲)

(PS: since this is off topic here, if you want to move the conversation onto discord feel free to ping me somewhere there 🙂 (https://discord.com/invite/cloudflaredev) )

dario-piotrowicz avatar Mar 17 '25 00:03 dario-piotrowicz

Also off topic question, If I can't use redirect in wrangler pages dev. How would KV work when using next dev, Currently for D1 I am using a work around where I point to a local db when running next dev?

Sorry I'm not completely sure I follow the question 😕 Are you asking how to use production values when running your application locally? (if that's the question, we don't currently have a solution for that but the team is working on one 🥲)

(PS: since this is off topic here, if you want to move the conversation onto discord feel free to ping me somewhere there 🙂 (https://discord.com/invite/cloudflaredev) )

No problem thank you very much for the help.

yusuf8ahmed avatar Mar 18 '25 07:03 yusuf8ahmed

The open-next adapter is (and has been for a while) stable , hopefully that addresses this issue 😄

dario-piotrowicz avatar Sep 26 '25 23:09 dario-piotrowicz