Does .dev.vars work in functions/_middleware.ts?

I’m trying to use environment variables in my middleware for honeycomb api key. Tried to capture everything in this screenshot:

The terminal in this screenshot is running npm run dev which is running the remix and wrangler scripts shown. You can see my .dev.vars in root at the bottom, and the middleware on the left.

this started working, I think there was a formatting issue in my .dev.vars. will mark this closed!

1 Like

hm, this has started not working again, not sure what I’m doing wrong. Everything looks how it does in the screenshot. This seemed to be working at some point yesterday :confused:

Ah, my problem was an errant wrangler.toml file in a parent directory to this project wrecking havoc. I was able to find this by using --log-level="debug" on wrangler pages dev ./public/, which might be helpful for others hitting a wall. Once I removed the errant file, it correctly found my .dev.vars file as expected.