cloudflare / workers-sdk

โ›…๏ธ Home to Wrangler, the CLI for Cloudflare Workersยฎ
https://developers.cloudflare.com/workers/
Apache License 2.0
2.63k stars 691 forks source link

๐Ÿ› BUG: #5662

Closed nneil closed 2 months ago

nneil commented 6 months ago

Which Cloudflare product(s) does this pertain to?

Wrangler core

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

3.51.2

What version of Node are you using?

v20.12.1

What operating system and version are you using?

Windows 10

Describe the Bug

When I execute an SQL file on my newly created local D1 database I get a "not authorized" error.

PS C:\Projects\cloudflare> wrangler d1 create dev
 โ›…๏ธ wrangler 3.51.2

[[d1_databases]]
binding = "DB" # i.e. available in your Worker on env.DB
database_name = "dev"
database_id = "77922c77-3436-431c-ac2d-4114a75840da"
PS C:\Projects\cloudflare> d1 execute dev --file .\sql\db_schema-drop.sql   
 โ›…๏ธ wrangler 3.51.2
-------------------
๐ŸŒ€ Mapping SQL input into an array of statements
๐ŸŒ€ Executing on local database dev (77922c77-3436-431c-ac2d-4114a75840da) from .wrangler\state\v3\d1:
๐ŸŒ€ To execute on your remote database, add a --remote flag to your wrangler command.

X [ERROR] not authorized

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

luckykellan commented 4 months ago

I am experiencing the same issue as reported in this thread. Here are some details about my environment and the error I am encountering:

Has there been any progress on this issue, or does anyone have a workaround or solution? Any help would be greatly appreciated.

luckykellan commented 4 months ago

I've managed to resolve the issue that was discussed in this thread. Here's what worked for me:

For anyone experiencing similar issues, please recheck your SQL file to ensure that the BEGIN TRANSACTION and COMMIT; statements have been removed, as mentioned in the documentation guidelines. This specific adjustment solved the problem for me.

Hope this helps anyone else facing the same issue.

penalosa commented 2 months ago

@nneil did @luckykellan's suggestion solve this for you?

nneil commented 2 months ago

Recently the ability to easily send email from Pages, using Mailchannel, was discontinued. I saw a message about this in the console, but it was not readily apparent to me what the replacement was. I wasted a day trying to find a replacement myself and was unable to find anything reasonable. In one case I was blocked because "my website does not have enough content". In another I could not jump through their hoops.

This made me realise that I cannot afford to rely on any third-parties.

Until Cloudflare provides it's own email service, as AWS does, I have been forced to go back to traditional development on normal cloud servers. Consequently I have not done any more work on this issue.

petebacondarwin commented 2 months ago

Cloudflare Workers do have the ability to send emails directly. See https://developers.cloudflare.com/email-routing/email-workers/send-email-workers/. Unfortunately this is not yet available in Cloudflare Pages.

petebacondarwin commented 2 months ago

Closing as the original issue looks like is would be resolved by following the documentation to migrate from SQLIte3 DB, and the original reporter is no longer using Pages.