You could maybe try building it in git actions and deploying with wrangler instead?
You could maybe try building it in git actions and deploying with wrangler instead?
service bindings with getRequestContext()?wrangler.toml but it is undefined.getServerSideProps or middleware)Cannot find module '@cloudflare/next-on-pages' or its corresponding type declarations when running next-on-pages on NextJs 14.Cannot find module. pnpm pages:build also report the same error.moduleResolution in tsconfig from node to bundler. I'm trying to deploy nowoutput: "export" in next.config.js and using npx next build as build command but it's not working.package.json and ideally should install all the packages present in package.json, right?node_modules folder?yarn install right? npx next build but you are using yarn, could you update the command to use yarn's alternative and try again? yarn install to update the lock file, push the change and try again?develop branch, let me try main....main: https://github.com/dario-piotrowicz/skill-tree-frontend/tree/mainsrc/server/db.ts ▲ Error: Failed to retrieve the Cloudflare request context. error when doing a next build. it works fine in developmentprocess.env.NODE_ENV === "development"
? getRequestContext().env.DB
: (process.env as any).DB worksError: Failed to publish your Function. Got error: Your Functions script is over the 1 MiB size limit (workers.api.error.script_too_large)servicegetRequestContext()const { env, cf, ctx } = getRequestContext();
Warning: The function cannot be called in code from components using the Pages router.getServerSidePropsmiddlewareCannot find module '@cloudflare/next-on-pages' or its corresponding type declarations{
"name": "lator-1-ivfcalc",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"format": "next lint --fix && prettier '**/*.{json,yaml}' --write --ignore-path .gitignore",
"db:generate": "drizzle-kit generate:sqlite",
"pages:build": "pnpm next-on-pages",
"preview": "pnpm pages:build && wrangler pages dev .vercel/output/static",
"deploy": "pnpm pages:build && wrangler pages deploy .vercel/output/static"
},
"dependencies": {
"@hookform/resolvers": "^3.3.4",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/react-toggle-group": "^1.0.4",
"@tiptap/extension-image": "^2.2.4",
"@tiptap/pm": "^2.2.4",
"@tiptap/react": "^2.2.4",
"@tiptap/starter-kit": "^2.2.4",
"@unpic/react": "^0.1.5",
"better-sqlite3": "^9.4.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"drizzle-orm": "^0.29.4",
"i18next": "^23.7.18",
"lucide-react": "^0.312.0",
"next": "14.1.0",
"react": "^18",
"react-dom": "^18",
"react-hook-form": "^7.49.3",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"usehooks-ts": "^2.9.5",
"zod": "^3.22.4",
"zod-i18n-map": "^2.25.0"
},
"devDependencies": {
"@cloudflare/next-on-pages": "0.0.0-9900517",
"@cloudflare/workers-types": "^4.20240222.0",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"drizzle-kit": "^0.20.14",
"eslint": "^8",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-next": "14.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-next-on-pages": "^1.10.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-tailwindcss": "^3.14.0",
"eslint-plugin-unused-imports": "^3.0.0",
"postcss": "^8",
"prettier": "^3.2.4",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}Cannot find modulepnpm pages:buildmoduleResolutionnodebundleroutput: "export"21:23:46.180 - info Linting and checking validity of types...
21:23:46.288 It looks like you're trying to use TypeScript but do not have the required package(s) installed.
21:23:46.288
21:23:46.288 Please install @types/react and @types/node by running:
21:23:46.288
21:23:46.289 yarn add --dev @types/react @types/node
21:23:46.289
21:23:46.289 If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).
21:23:46.289
21:23:46.327 - error ESLint must be installed in order to run during builds: yarn add --dev eslint
21:23:46.508 Failed: Error while executing user command. Exited with error code: 1
21:23:46.518 Failed: build command exited with code: 1
21:23:47.549 Failed: error occurred while running build commandnpx next builddevelopsrc/server/db.ts▲ Error: Failed to retrieve the Cloudflare request context.next buildprocess.env.NODE_ENV === "development"
? getRequestContext().env.DB
: (process.env as any).DB"use server";
import { getRequestContext } from "@cloudflare/next-on-pages";
import { Repository, getDB } from "@my-separate-package/db";
export const db = getDB(getRequestContext().env.DB ?? process.env.DB);
export const repository = new Repository(db);