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

About the sample code in d1-and-remix.md #15016

Open
aozou99 opened this issue Jun 8, 2024 · 0 comments
Open

About the sample code in d1-and-remix.md #15016

aozou99 opened this issue Jun 8, 2024 · 0 comments
Assignees
Labels
content:edit Request for content edits documentation Documentation edits product:d1 D1: https://developers.cloudflare.com/d1/

Comments

@aozou99
Copy link

aozou99 commented Jun 8, 2024

Existing documentation URL(s)

What changes are you suggesting?

The context.env as Env part of the sample code below would not have worked in my environment unless it was context.cloudflare.env as Env

I assume that the version upgrade of one of the cloudflare libraries is probably affecting this, so please include the correct sample code for each version.

export const loader: LoaderFunction = async ({ context, params }) => {
  let env = context.env as Env;

  let { results } = await env.DB.prepare("SELECT * FROM users LIMIT 5").all();
  return json(results);
};

package.json

        "@remix-run/cloudflare": "^2.9.2",
        "@remix-run/cloudflare-pages": "^2.9.2",
        "@cloudflare/workers-types": "^4.20240605.0",
        "wrangler": "^3.60.0"

Additional information

No response

@aozou99 aozou99 added content:edit Request for content edits documentation Documentation edits labels Jun 8, 2024
@github-actions github-actions bot added the product:d1 D1: https://developers.cloudflare.com/d1/ label Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content:edit Request for content edits documentation Documentation edits product:d1 D1: https://developers.cloudflare.com/d1/
Projects
None yet
Development

No branches or pull requests

6 participants