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

miniflare should stringify all env vars #50

Closed
ozburo opened this issue Sep 22, 2021 · 3 comments
Closed

miniflare should stringify all env vars #50

ozburo opened this issue Sep 22, 2021 · 3 comments
Labels
behaviour mismatch Different behaviour to Workers runtime fixed-in-next Fixed in next release

Comments

@ozburo
Copy link

ozburo commented Sep 22, 2021

Hello there!

Cloudflare stringyfies all environment variables, but miniflare respects/maintains the var type.

This might cause confusion/bugs and detours from what's expected when using wrangler etc.

[vars]
MY_VAR = true

Using miniflare:

console.log(typeof env.MY_VAR) // boolean

Using wrangler:

console.log(typeof env.MY_VAR) // string

It's not a huge thing but I thought I'd mention it.

Thanks again for this project, it's been a life saver!

@mrbbot
Copy link
Contributor

mrbbot commented Sep 22, 2021

Hey! 👋 Great catch! I'll definitely fix this in the next version. I guess just use "true" for now... 😅
Glad it's helped you out. 🙂

@mrbbot mrbbot added the behaviour mismatch Different behaviour to Workers runtime label Sep 27, 2021
@mrbbot mrbbot added the fixed-in-next Fixed in next release label Oct 19, 2021
@mrbbot
Copy link
Contributor

mrbbot commented Oct 27, 2021

Hey! 👋 The first pre-release of Miniflare 2 has just been released, including this change. You can find the full changelog here and install it with npm i miniflare@next -D. Please let me know if you have any other issues, and feel free to ask questions in the #miniflare channel of the Cloudflare Workers Discord server.

@null-prophet
Copy link

Hey I have been working with honojs and cloudflare recently and I have noticed that env vars like booleans (mapped in a bindings.d.ts ) are mapped to true objects like boolean when I run on the command line but no in miniflare.

Is this some kind of regression or am I doing something wrong?

The issue on the honojs site outlines the full scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behaviour mismatch Different behaviour to Workers runtime fixed-in-next Fixed in next release
Projects
None yet
Development

No branches or pull requests

3 participants