Skip to content

Fix production Turnstile "Could not complete bot check" - #331

Merged
mxschmitt merged 1 commit into
mainfrom
cursor/fix-turnstile-bot-check-8395
Sep 4, 2026
Merged

Fix production Turnstile "Could not complete bot check"#331
mxschmitt merged 1 commit into
mainfrom
cursor/fix-turnstile-bot-check-8395

Conversation

@mxschmitt

@mxschmitt mxschmitt commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Why

Two production bugs after clicking Run on https://try.playwright.tech:

  1. Error: Could not complete bot check. Please try again.
  2. The editor column collapses to ~200px, clipping the code, while the Content area stays full height.

Bot check

The frontend gate calls turnstile.ready() after api.js has already loaded with async. Cloudflare throws:

TurnstileError: [Cloudflare Turnstile] Remove async/defer from the Turnstile api.js script tag before using turnstile.ready().

That throw is caught in requestToken and treated as an empty token, so the UI never starts the challenge.

Fix: stop calling turnstile.ready(). waitForApi() already waits until render and execute exist.

Editor height

height: 100% on Grid/Row/Col does not resolve against Content's flex-induced height: auto. Layout is therefore content-sized. Examples are tall enough to look fine; a short error output collapses the grid to ~216px.

Fix: fill Content → Grid → Row → columns with flex: 1; min-height: 0 instead of percentage heights.

Tests

  • frontend: npx playwright test src/turnstile.spec.ts
  • frontend: npx playwright test src/components/App/index.spec.tsx — includes a new case that Run + short error keeps both columns viewport-tall
Open in Web Open in Cursor 

Production loads api.js with async, and Cloudflare throws if ready()
is called on that script. The gate treated that throw as a failed
challenge, so Run always showed "Could not complete bot check".
Wait for render/execute instead; they are already enough.

Co-authored-by: Max Schmitt <max@schmitt.mx>
@mxschmitt
mxschmitt marked this pull request as ready for review September 4, 2026 05:25
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T05:26:54.799490Z aa1f884 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mxschmitt
mxschmitt merged commit f63088e into main Sep 4, 2026
10 checks passed
@mxschmitt
mxschmitt deleted the cursor/fix-turnstile-bot-check-8395 branch September 4, 2026 05:25
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.

2 participants