Coolio85
Coolio85
CDCloudflare Developers
Created by Coolio85 on 6/9/2024 in #pages-help
Error deleting pages project
It does have an access application attached to it though, could that be causing the issue? I thought they were automatically cleaned up but maybe it's got in some glitched state
7 replies
CDCloudflare Developers
Created by Coolio85 on 6/9/2024 in #pages-help
Error deleting pages project
Nope, I removed them before attempting to delete it
7 replies
CDCloudflare Developers
Created by Coolio85 on 6/9/2024 in #pages-help
Error deleting pages project
Only has 25 deployments
7 replies
CDCloudflare Developers
Created by lettucebaran on 5/20/2024 in #pages-help
How can I access `env.DB` in my Pages/Worker on production?
One thing I can suggest, is try getting rid of the conditional regarding process.env.NODE_ENV, my nextjs pages project looks similar to this
import { getRequestContext } from "@cloudflare/next-on-pages"
import { PrismaClient } from '@prisma/client'
import { PrismaD1 } from '@prisma/adapter-d1'

const getDb = (): PrismaClient => {
const binding = getRequestContext().env.DB;

const adapter = new PrismaD1(binding)
const prisma = new PrismaClient({ adapter })

return prisma;
}

export default getDb;
import { getRequestContext } from "@cloudflare/next-on-pages"
import { PrismaClient } from '@prisma/client'
import { PrismaD1 } from '@prisma/adapter-d1'

const getDb = (): PrismaClient => {
const binding = getRequestContext().env.DB;

const adapter = new PrismaD1(binding)
const prisma = new PrismaClient({ adapter })

return prisma;
}

export default getDb;
With a wrangler file of
[[d1_databases]]
binding = "DB"
database_name = "name"
database_id = "[ID]"
preview_database_id = "[ID]"

[[env.preview.d1_databases]]
binding = "DB"
database_name = "name"
database_id = "[ID]"
preview_database_id = "[ID]"
[[d1_databases]]
binding = "DB"
database_name = "name"
database_id = "[ID]"
preview_database_id = "[ID]"

[[env.preview.d1_databases]]
binding = "DB"
database_name = "name"
database_id = "[ID]"
preview_database_id = "[ID]"
41 replies
CDCloudflare Developers
Created by lettucebaran on 5/20/2024 in #pages-help
How can I access `env.DB` in my Pages/Worker on production?
👍 only saying because I've definitely not done that before :hide_the_pain: :laughingpepe:
41 replies
CDCloudflare Developers
Created by lettucebaran on 5/20/2024 in #pages-help
How can I access `env.DB` in my Pages/Worker on production?
This might sound simple, but did you update these values for the d1 database you want to bind?
41 replies
CDCloudflare Developers
Created by Jure on 9/19/2023 in #pages-help
Is possible to run migrations in Pages build command?
Replace the preCommands npx @cloudflare/next-on-pages@1 with npm run build or whatever :awesome:
6 replies
CDCloudflare Developers
Created by Jure on 9/19/2023 in #pages-help
Is possible to run migrations in Pages build command?
This is my example preview deployment,yml
name: Preview Deployment

on:
push:
branches-ignore:
- "main"

jobs:
deploy-preview:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
name: Preview Deployment
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
preCommands: |
npm install
npx @cloudflare/next-on-pages@1
command: pages deploy --project-name=[PROJECT NAME] --commit-dirty
postCommands: |
echo "*** Applying Preview Migrations ***"
npx wrangler d1 migrations apply [PROJECT NAME] --preview --remote
echo "******"
name: Preview Deployment

on:
push:
branches-ignore:
- "main"

jobs:
deploy-preview:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
name: Preview Deployment
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
preCommands: |
npm install
npx @cloudflare/next-on-pages@1
command: pages deploy --project-name=[PROJECT NAME] --commit-dirty
postCommands: |
echo "*** Applying Preview Migrations ***"
npx wrangler d1 migrations apply [PROJECT NAME] --preview --remote
echo "******"
6 replies
CDCloudflare Developers
Created by Jure on 9/19/2023 in #pages-help
Is possible to run migrations in Pages build command?
The way I've tackled this issue is by using github actions to deploy and push to pages, and then run a command after which runs migrations
6 replies
CDCloudflare Developers
Created by misterpoppins on 4/29/2024 in #pages-help
ERROR: Could not resolve "crypto"
Thanks a lot :awesome:
4 replies
CDCloudflare Developers
Created by misterpoppins on 4/29/2024 in #pages-help
ERROR: Could not resolve "crypto"
Hey, did you manage to find a solution to this, I'm facing a similar issue regarding crypto with nextjs?
4 replies