Open uceumice opened 1 year ago
Out of curiosity @uceumice , does this happen when you create a db with --experimental-backend
?
Hi @rozenmd,
I have the same problem! In my case, the database had already been created in the CloudFlare dashboard (i don't use --experimental-backend
flag), but it was empty and without any data. I only ran the migrations command (wrangler d1 migrations apply my-db-name
) from GitHub Actions using CLOUDFLARE_API_TOKEN secret in my CI:
โฒ [WARNING] Processing wrangler.toml configuration:
- D1 Bindings are currently in alpha to allow the API to evolve before general availability.
Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
Note: Run this command with the environment variable NO_D1_WARNING=true to hide this message
For example: `export NO_D1_WARNING=true && wrangler <YOUR COMMAND HERE>`
--------------------
๐ง D1 is currently in open alpha and is not recommended for production data and traffic
๐ง Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
๐ง To request features, visit https://community.cloudflare.com/c/developers/d1
๐ง To give feedback, visit https://discord.gg/cloudflaredev
--------------------
Migrations to be applied:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ name โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 0000_create_initial_tables.sql โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
? About to apply 1 migration(s)
Your database may not be available to serve requests during the migration, continue?
๐ค Using default value in non-interactive context: yes
๐ Creating backup...
๐ Mapping SQL input into an array of statements
๐ Parsing 3 statements
๐ Executing on my-db-name (e2***ea6-8**5-4**4-b**0-f79e****cfc97):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโ
โ name โ status โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโค
โ 0000_create_initial_tables.sql โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโ
โ Migration 0000_create_initial_tables.sql failed with the following errors:
โ [ERROR] Internal error: Error sending request to D1 for database e2***ea6-8**5-4**4-b**0-f79e****cfc97 [code: 7[50](https://github.com/****/****/actions/runs/5284****86/jobs/956****365#step:5:51)1]
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
Error: Process completed with exit code 1.
I ran the command again from my PC, with the same token, and this time it showed me the same message as the issue's initiator comments:
After rerunning the action manually, the migrations status was confirmed as already applies and no further migrations were run:
โ No migrations to apply!
.
Thanks!
no, I did not use the
--experimental-backend
.
@uceumice / @cristiammercado could you try again with the --experimental-backend? it fixes a lot of the issues D1 was having with queries running out of RAM and randomly failing.
Hi @rozenmd,
When executing the command wrangler d1 migrations apply a-db-test
with a database created with the flag --experimental-backend
, an error occurs and it is that it is not possible to create backups with an experimental database, I leave the output of the command below:
โฒ [WARNING] Processing wrangler.toml configuration:
- D1 Bindings are currently in alpha to allow the API to evolve before general availability.
Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
Note: Run this command with the environment variable NO_D1_WARNING=true to hide this message
For example: `export NO_D1_WARNING=true && wrangler <YOUR COMMAND HERE>`
- D1 Bindings are currently in alpha to allow the API to evolve before general availability.
Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
Note: Run this command with the environment variable NO_D1_WARNING=true to hide this message
For example: `export NO_D1_WARNING=true && wrangler <YOUR COMMAND HERE>`
--------------------
๐ง D1 is currently in open alpha and is not recommended for production data and traffic
๐ง Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
๐ง To request features, visit https://community.cloudflare.com/c/developers/d1
๐ง To give feedback, visit https://discord.gg/cloudflaredev
--------------------
Migrations to be applied:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ name โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 0000_create_initial_tables.sql โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ About to apply 1 migration(s)
Your database may not be available to serve requests during the migration, continue? ... yes
๐ Creating backup...
X [ERROR] A request to the Cloudflare API (/accounts/f7cd1e1e*******10ae71******9f2/d1/database/82*****9-c**1-4**0-8**8-6ca******673/backup) failed.
The request is malformed: Experimental DBs do not support backups yet:
82*****9-c**1-4**0-8**8-6ca******673 (v3) [code: 7400]
If you think this is a bug, please open an issue at:
https://github.com/cloudflare/workers-sdk/issues/new/choose
Ah @cristiammercado that's a bug I need to fix - can you try run wrangler d1 migrations apply a-db-test --experimental-backend
for now?
Ey @rozenmd, executing the command with the flag wrangler d1 migrations apply a-db-test --experimental-backend
the command did work! I'm testing it from my local, if I notice a difference in CI I will share it with you, but I am almost sure that it is the same behavior.
I leave the output of the command:
โฒ [WARNING] Processing wrangler.toml configuration:
- D1 Bindings are currently in alpha to allow the API to evolve before general availability.
Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
Note: Run this command with the environment variable NO_D1_WARNING=true to hide this message
For example: `export NO_D1_WARNING=true && wrangler <YOUR COMMAND HERE>`
- D1 Bindings are currently in alpha to allow the API to evolve before general availability.
Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
Note: Run this command with the environment variable NO_D1_WARNING=true to hide this message
For example: `export NO_D1_WARNING=true && wrangler <YOUR COMMAND HERE>`
--------------------
๐ง D1 is currently in open alpha and is not recommended for production data and traffic
๐ง Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
๐ง To request features, visit https://community.cloudflare.com/c/developers/d1
๐ง To give feedback, visit https://discord.gg/cloudflaredev
--------------------
Migrations to be applied:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ name โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 0000_create_initial_tables.sql โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ About to apply 1 migration(s)
Your database may not be available to serve requests during the migration, continue? ... yes
๐ Mapping SQL input into an array of statements
๐ Parsing 7 statements
๐ Executing on a-db-test (82*****9-c**1-4**0-8**8-6ca******673):
๐ฃ Executed 7 commands in 0.8147279999684542ms
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโ
โ name โ status โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโค
โ 0000_create_initial_tables.sql โ โ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโ
HI, I'm having a similar error when applying migrations. It works on local smoothly but it doesn't when it's applied via GitHub Actions
This works when applied on the command line
wrangler d1 migrations apply d1_turbolang --preview --experimental-backend
When applied via GH Actions
Run cd ./apps/remix-admin
cd ./apps/remix-admin
npx wrangler d1 migrations apply d1_turbolang --preview --experimental-backend
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
CLOUDFLARE_API_TOKEN: ***
CLOUDFLARE_ACCOUNT_ID: ***
โฒ [WARNING] Processing wrangler.toml configuration:
- D1 Bindings are currently in alpha to allow the API to evolve before general availability.
Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose
Note: Run this command with the environment variable NO_D1_WARNING=true to hide this message
For example: `export NO_D1_WARNING=true && wrangler <YOUR COMMAND HERE>`
--------------------
๐ง D1 is currently in open alpha and is not recommended for production data and traffic
๐ง Please report any bugs to https://github.com/cloudflare/workers-sdk/issues/new/choose
๐ง To request features, visit https://community.cloudflare.com/c/developers/d1
๐ง To give feedback, visit https://discord.gg/cloudflaredev
--------------------
Error: Process completed with exit code 1.
I'm using drizzle-kit
to generate the migrations
Which Cloudflare product(s) does this pertain to?
D1
What version of
Wrangler
are you using?3.1.0
What operating system are you using?
Linux (ubuntu-latest/github-actions)
Describe the Bug
I have got a strange error when running migrations on recently created, empty D1 database. Both migrations listed below where applied and I can confirm it inspecting the database. All required tables were created with right types and right indexes, however I still got an error telling otherwise.
After rerunning the action manually, the migrations status was confirmed as already applies and no further migrations were run:
โ No migrations to apply!
.Here is the run logs, from the point of applying the migrations:
0001**********.sql
0002**********.sql
Running
name | type | sql -- | -- | -- d1_kv | table | CREATE TABLE d1_kv (key TEXT PRIMARY KEY, value TEXT NOT NULL) sqlite_autoindex_d1_kv_1 | index |SELECT name, type, sql FROM sqlite_schema;
gives: