Cloudflare D1 database is not found in ENV that breaks integrations

For Workers & Pages, what is the name of the domain?

https://falling-hall-643e.pages.dev/

What is the error message?

[ERROR] TypeError: Cannot read properties of undefined (reading ‘env’)

What is the issue or error you’re encountering

When I run wrangler pages dev I have this error. I suspect I have the same on deploy but I just don’t see this error. At least I have Internal Server Error from the API endpoint.

What steps have you taken to resolve the issue?

There’s more detailed investigation process with steps of reproducing.

Also, I prepared a similar repo but without Nuxt 3 layers architecture to exclude a guessing that it happens because of layers:

This repo was prepared by following the guide from the Cloudflare Docs:

What are the steps to reproduce the issue?

See the link above

Screenshot of the error

The issue caused because of strict path to directory where the wrangler.json file has to be generated in Nitro.
I prepare a PR to the Nitro directory with the detailed explanation what it solves:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.