cloudflare / cloudflare/developer-platform
π BUG: `[7501]` error after a successfully complete migration...
- Dominant language
- No language data
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### 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:
```
Run pnpm run db.apply
pnpm run db.apply
shell: /usr/bin/bash -e {0}
env:
PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
CLOUDFLARE_API_TOKEN: ***
> @*****/*****@ db.apply /home/runner/work/*****/*****/apps/*****/*****
> wrangler d1 migrations apply blog
β² [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 `
--------------------
π§ 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_panoramic_sleeper.sql β
ββββββββββββββββββββββββββββββ€
β 0001_melodic_sentry.sql β
ββββββββββββββββββββββββββββββ
? About to apply [2](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****) 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 4 statements
π Executing on *****(ede788c4-771d-410a-91[3](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)0-[4](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)fefd3788ab[5](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)):
π£ Executed 4 commands in 21.27123999595[6](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)42ms
ββββββββββββββββββββββββββββββ¬βββββββββ
β name β status β
ββββββββββββββββββββββββββββββΌβββββββββ€
β 0000_*****_*****.sql β β
β
ββββββββββββββββββββββββββββββΌβββββββββ€
β 0001_*****_*****.sql β ποΈ β
ββββββββββββββββββββββββββββββ΄βββββββββ
π Mapping SQL input into an array of statements
π Parsing 4 statements
π Executing on blog (ede[7](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)[8](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)8c4-771d-410a-[9](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)130-4fefd3788ab5):
ββββββββββββββββββββββββββββββ¬βββββββββ
β name β status β
ββββββββββββββββββββββββββββββΌβββββββββ€
β 0000_*****_*****.sql β β
β
ββββββββββββββββββββββββββββββΌβββββββββ€
β 0001_*****_*****.sql β β β
ββββββββββββββββββββββββββββββ΄βββββββββ
β Migration 0001_*****_*****.sql failed with the following errors:
β [ERROR] Internal error: Error sending request to D1 for database ede788c4-771d-4[10](https://github.com/*****/*****/actions/runs/*****/jobs/*****#step:*****)a-9130-4fefd3788ab5 [code: 7501]
If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
βELIFECYCLEβ Command failed with exit code 1.
Error: Process completed with exit code 1.
```
0001_*****_*****.sql
```sql
CREATE TABLE `emails` (
`id` integer PRIMARY KEY NOT NULL,
`email` text(320) NOT NULL,
`token` text(21) NOT NULL,
`timestamp` integer NOT NULL
);
CREATE UNIQUE INDEX `idx_unique_token` ON `emails` (`token`);
CREATE UNIQUE INDEX `idx_unique_email` ON `emails` (`email`);
```
0002_*****_*****.sql
```sql
CREATE TABLE `access.access` (
`id` integer PRIMARY KEY NOT NULL,
`ipid` integer NOT NULL,
`timestamp` integer NOT NULL,
FOREIGN KEY (`ipid`) REFERENCES `access.ips`(`id`)
);
CREATE TABLE `access.ips` (
`id` integer PRIMARY KEY NOT NULL,
`ip` text(45) NOT NULL,
`type` text NOT NULL
);
CREATE UNIQUE INDEX `idx_unique_ip` ON `access.ips` (`ip`);
```
Running `SELECT name, type, sql FROM sqlite_schema;` gives:
name | type | sql
-- | -- | --
d1_kv | table | CREATE TABLE d1_kv (key TEXT PRIMARY KEY, value TEXT NOT NULL)
sqlite_autoindex_d1_kv_1 | index |
__drizzle_migrations | table | CREATE TABLE __drizzle_migrations( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE, applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL )
sqlite_autoindex___drizzle_migrations_1 | index |
sqlite_sequence | table | CREATE TABLE sqlite_sequence(name,seq)
emails | table | CREATE TABLE `emails` ( `id` integer PRIMARY KEY NOT NULL, `email` text(320) NOT NULL, `token` text(21) NOT NULL, `timestamp` integer NOT NULL )
idx_unique_token | index | CREATE UNIQUE INDEX `idx_unique_token` ON `emails` (`token`)
idx_unique_email | index | CREATE UNIQUE INDEX `idx_unique_email` ON `emails` (`email`)
access.access | table | CREATE TABLE `access.access` ( `id` integer PRIMARY KEY NOT NULL, `ipid` integer NOT NULL, `timestamp` integer NOT NULL, FOREIGN KEY (`ipid`) REFERENCES `access.ips`(`id`) )
access.ips | table | CREATE TABLE `access.ips` ( `id` integer PRIMARY KEY NOT NULL, `ip` text(45) NOT NULL, `type` text NOT NULL )
idx_unique_ip | index | CREATE UNIQUE INDEX `idx_unique_ip` ON `access.ips` (`ip`)
Contributor guide
Assessment
This issue has not been assessed yet.