Skip to content

fix: do not log expected expected D1 errors#1246

Merged
vicb merged 2 commits intomainfrom
vicb/no-d1-alter-error
May 4, 2026
Merged

fix: do not log expected expected D1 errors#1246
vicb merged 2 commits intomainfrom
vicb/no-d1-alter-error

Conversation

@vicb
Copy link
Copy Markdown
Contributor

@vicb vicb commented May 4, 2026

A user reported this error on Discord:

Populating remote R2 incremental cache...
 ⛅️ wrangler 4.87.0
───────────────────
✘ [ERROR] You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log in via OAuth.
🪵  Logs were written to "/root/.config/.wrangler/logs/wrangler-2026-05-02_02-38-22_506.log"
(node:2118) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
 25%|███████████                                  | 1/4 [00:00:<00:00:, 0.00it/s] 50%|██████████████████████                       | 2/4 [00:02:<00:02:, 0.99it/s] 75%|█████████████████████████████████            | 3/4 [00:02:<00:00:, 1.49it/s]100%|█████████████████████████████████████████████| 4/4 [00:02:<00:00:, 1.70it/s]
Successfully populated cache with 4 entries
Creating D1 table if necessary...
✘ [ERROR] A request to the Cloudflare API (/accounts/6b222270f00e0e9c6707c0016bb1c80c/d1/database/f5de6e68-6866-4615-a33a-86ddfa5aba14/query) failed.
  duplicate column name: stale: SQLITE_ERROR [code: 7500]
  
  If you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose
🪵  Logs were written to "/root/.config/.wrangler/logs/wrangler-2026-05-02_02-38-31_763.log"
 ⛅️ wrangler 4.87.0
───────────────────
Resource location: remote 
🌀 Executing on remote database NEXT_TAG_CACHE_D1 (f5de6e68-6866-4615-a33a-86ddfa5aba14):
🌀 To execute on your local development database, remove the --remote flag from your wrangler command.
Successfully created D1 table

As explained in the changelog, the error is expected when the column exists.


Open in Devin Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: a6da948

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vicb vicb requested a review from conico974 May 4, 2026 08:07
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@1246

commit: a6da948

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Copy link
Copy Markdown
Collaborator

@sommeeeer sommeeeer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would it make sense to use NOT EXISTS instead?

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented May 4, 2026

LGTM, would it make sense to use NOT EXISTS instead?

Unfortunately, it is not supported for ALTER TABLE ADD COLUMN in SQLite.

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented May 4, 2026

Thanks for the review Magnus!

Comment thread .changeset/eleven-parents-send.md Outdated
Co-authored-by: Victor Berchet <victor@suumit.com>
Copy link
Copy Markdown
Collaborator

@james-elicx james-elicx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably do a query that checks if they exist already, but any real errors would likely already be flagged by this point i imagine

@vicb
Copy link
Copy Markdown
Contributor Author

vicb commented May 4, 2026

We could probably do a query that checks if they exist already, but any real errors would likely already be flagged by this point i imagine

I thought about that first but I don't think it would be better than the simple solution implemented in this PR.

WDYT?

Thanks James

@james-elicx
Copy link
Copy Markdown
Collaborator

We could probably do a query that checks if they exist already, but any real errors would likely already be flagged by this point i imagine

I thought about that first but I don't think it would be better than the simple solution implemented in this PR.

WDYT?

Thanks James

Yeah i would probably agree

@vicb vicb merged commit 5d2014f into main May 4, 2026
8 checks passed
@vicb vicb deleted the vicb/no-d1-alter-error branch May 4, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants