cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.41k stars 590 forks source link

🐛 BUG: wrangler D1 export doesn't work #6135

Open GeorgeTailor opened 6 days ago

GeorgeTailor commented 6 days ago

Which Cloudflare product(s) does this pertain to?

D1, Wrangler core

What version(s) of the tool(s) are you using?

3.61.0

What version of Node are you using?

20.10

What operating system and version are you using?

Windows 11

Describe the Bug

Observed behavior

go to https://developers.cloudflare.com/d1/build-with-d1/import-export-data/#export-an-existing-d1-database

copy paste npx wrangler d1 export <database_name> --remote --output=./database.sql change to actual database name run

I am forced to allow access via browser, but it ends up in error:

Unable to connect

Firefox can’t establish a connection to the server at localhost:8976.

and in command line:

node_modules\wrangler\wrangler-dist\cli.js:29747
            throw a;
            ^

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

Expected behavior

It should just work

Steps to reproduce

all steps are described in Observed behaviour

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

GeorgeTailor commented 6 days ago

generating export via API also doesn't work properly, the response file is riddled with:

INSERT INTO comment VALUES('edae5276-cff9-4d9d-ae1f-b9432a296ea8','5e76df81-3955-45e5-955e-4b70b0eb1e6a','Так це слово і використовується як слюр в США (за Європу не знаю). Там ситуація з ним така ж, як тут. Воно набуло слюрного значення, та деякі трансвиключні феміністки (якщо не більшість) не хочуть, аби їх так називали, натомість вигадуючи інакші терміни. Тому воно не безпідставно слюрне','115',1693771129);
GeorgeTailor commented 4 days ago

seems that this problem is related to broken wrangler integration, wrangler cannot aquire authorization for any functions. I have also tried wrangler pages deployment tail and encoutered the same problem.

any help?

GeorgeTailor commented 4 days ago

to make things even more funny, this is the response that wrangler gets:

<div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>
    <div id="cf-error-details" class="cf-error-details-wrapper">
      <div class="cf-wrapper cf-header cf-error-overview">
        <h1 data-translate="block_headline">Sorry, you have been blocked</h1>
        <h2 class="cf-subheadline"><span data-translate="unable_to_access">You are unable to access</span> dash.cloudflare.com</h2>
      </div><!-- /.header -->

      <div class="cf-section cf-highlight">
        <div class="cf-wrapper">
          <div class="cf-screenshot-container cf-screenshot-full">

              <span class="cf-no-screenshot error"></span>

          </div>
        </div>
      </div><!-- /.captcha-container -->

      <div class="cf-section cf-wrapper">
        <div class="cf-columns two">
          <div class="cf-column">
            <h2 data-translate="blocked_why_headline">Why have I been blocked?</h2>

            <p data-translate="blocked_why_detail">This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.</p>
          </div>

          <div class="cf-column">
            <h2 data-translate="blocked_resolve_headline">What can I do to resolve this?</h2>

            <p data-translate="blocked_resolve_detail">You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.</p>
          </div>
        </div>
      </div><!-- /.section -->
alexcroox commented 4 days ago

I think wrangler CLI is broken in general. I'm getting the same error with wrangler pages deployment tail. During the oauth dance the callback is hitting the same error in terminal:

/Users/alex/Projects/saas/node_modules/wrangler/wrangler-dist/cli.js:29747
            throw a;
            ^

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at parseJSONFromBytes (/Users/alex/Projects/saas/node_modules/wrangler/wrangler-dist/cli.js:5287:19)
michael1979er commented 3 days ago

i had the same problem, when i first run "wrangler login" in the console, everything seems to be fine.