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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Parameter binding handled differently between local miniflare and cloud #2811

Closed
codehz opened this issue Feb 27, 2023 · 1 comment 路 Fixed by cloudflare/miniflare#544 or #2942
Labels
bug Something that isn't working miniflare Relating to Miniflare

Comments

@codehz
Copy link

codehz commented Feb 27, 2023

Which Cloudflare product(s) does this pertain to?

D1

What version of Wrangler are you using?

2.11.1

What operating system are you using?

Mac

Describe the Bug

TLDR,
ctx.DB.prepare('SELECT ?1').bind(1) produce Error Error: Error: RangeError: Too many parameter values were provided in local mode but it works in cloud version
Related issue (since miniflare use better-sqlite3): WiseLibs/better-sqlite3#576
(DB is D1 database)
(command line is: wrangler dev --local --persist)

@codehz codehz added the bug Something that isn't working label Feb 27, 2023
@mrbbot
Copy link
Contributor

mrbbot commented Mar 2, 2023

Hey! 馃憢 This is very likely the same issue as cloudflare/miniflare#504. I'll leave this issue open to track upgrading Miniflare to a fixed version.

@mrbbot mrbbot added the miniflare Relating to Miniflare label Mar 2, 2023
mrbbot added a commit to cloudflare/miniflare that referenced this issue Mar 22, 2023
`better-sqlite3` expects parameters of the form `?1, ?2, ...` to be
bound as an object of the form `{ 1: params[0], 2: params[1], ...}`.
In #480, we accidentally removed the code that handled this case.
This PR adds it back, and lifts out some common functionality into a
`#prepareAndBind()` function. :)

Thanks @ruslantalpa for spotting the removed code.

Closes #526
Closes cloudflare/workers-sdk#2811
Closes cloudflare/workers-sdk#2887
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working miniflare Relating to Miniflare
Projects
Archived in project
2 participants