Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Internal Error #3985

Closed
willin opened this issue Sep 20, 2023 · 6 comments
Closed

🐛 BUG: Internal Error #3985

willin opened this issue Sep 20, 2023 · 6 comments
Assignees
Labels
bug Something that isn't working d1 Relating to D1 pages Relating to Pages

Comments

@willin
Copy link

willin commented Sep 20, 2023

Which Cloudflare product(s) does this pertain to?

D1

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

⛅️ wrangler 3.8.0

What version of Node are you using?

20

What operating system are you using?

Mac

Describe the Bug

image image

Please provide a link to a minimal reproduction

willin/remix-cloudflare-pages-demo@aef7df9

# local dev
pnpm db:schema
pnpm db:init --local
pnpm db:migration --local
pnpm dev
# create table already done. 👌
pnpm db:init 
pnpm db:migration 

Please provide any relevant error logs

None....

{
  "outcome": "ok",
  "scriptName": "pages-worker--1418209-production",
  "diagnosticsChannelEvents": [],
  "exceptions": [],
  "logs": [],
  "eventTimestamp": 1695192742441,
  "event": {
    "request": {
      "url": "https://cf.js.cool/",
      "method": "GET",
      "headers": {
        "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
        "accept-encoding": "gzip",
        "accept-language": "zh-CN,zh;q=0.8",
        "cache-control": "max-age=0",
        "cf-connecting-ip": "180.111.81.166",
        "cf-connecting-o2o": "1",
        "cf-ipcountry": "CN",
        "cf-ray": "8098252fde12dc8f",
        "cf-visitor": "{\"scheme\":\"https\"}",
        "connection": "Keep-Alive",
        "cookie": "REDACTED",
        "host": "cf.js.cool",
        "sec-ch-ua": "\"Brave\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"macOS\"",
        "sec-fetch-dest": "document",
        "sec-fetch-mode": "navigate",
        "sec-fetch-site": "cross-site",
        "sec-fetch-user": "?1",
        "sec-gpc": "1",
        "upgrade-insecure-requests": "1",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
        "x-forwarded-for": "180.111.81.166",
        "x-forwarded-proto": "https",
        "x-real-ip": "180.111.81.166"
      },
      "cf": {
        "longitude": "121.45810",
        "httpProtocol": "HTTP/2",
        "tlsCipher": "AEAD-AES128-GCM-SHA256",
        "continent": "AS",
        "asn": 4134,
        "clientAcceptEncoding": "gzip",
        "country": "CN",
        "tlsClientAuth": {
          "certIssuerDNLegacy": "",
          "certIssuerSKI": "",
          "certSubjectDNRFC2253": "",
          "certSubjectDNLegacy": "",
          "certFingerprintSHA256": "",
          "certNotBefore": "",
          "certSKI": "",
          "certSerial": "",
          "certIssuerDN": "",
          "certVerified": "NONE",
          "certNotAfter": "",
          "certSubjectDN": "",
          "certPresented": "0",
          "certRevoked": "0",
          "certIssuerSerial": "",
          "certIssuerDNRFC2253": "",
          "certFingerprintSHA1": ""
        },
        "tlsVersion": "TLSv1.3",
        "city": "Shanghai",
        "timezone": "Asia/Shanghai",
        "colo": "LHR",
        "edgeRequestKeepAliveStatus": 1,
        "requestPriority": "weight=256;exclusive=1",
        "latitude": "31.22220",
        "region": "Shanghai",
        "regionCode": "SH",
        "asOrganization": "China Telecom",
        "pagesHostName": "remix-cloudflare-pages-demo-5co.pages.dev",
        "botManagement": {
          "corporateProxy": false,
          "verifiedBot": false,
          "jsDetection": {
            "passed": false
          },
          "staticResource": false,
          "detectionIds": {},
          "score": 99
        }
      }
    },
    "response": {
      "status": 500
    }
  },
  "id": 0
}
@willin willin added the bug Something that isn't working label Sep 20, 2023
@KianNH
Copy link
Contributor

KianNH commented Sep 20, 2023

Internal Error isn't something being returned by Cloudflare, it's by Remix.

https://github.com/remix-run/remix/blob/f7b90d4c26998f6c918a40056e2214fd28f21c7b/packages/remix-cloudflare-pages/worker.ts#L74-L88

They're swallowing the error (hence no logs) unless you have a variable of NODE_ENV set to "development".

@willin
Copy link
Author

willin commented Sep 20, 2023

"Error: D1_ERROR: not authorized"

@willin
Copy link
Author

willin commented Sep 20, 2023

image

@willin
Copy link
Author

willin commented Sep 20, 2023

{
  "outcome": "ok",
  "scriptName": "pages-worker--1418209-production",
  "diagnosticsChannelEvents": [],
  "exceptions": [],
  "logs": [
    {
      "message": [
        "Error: D1_ERROR: not authorized"
      ],
      "level": "error",
      "timestamp": 1695203265686
    }
  ],
  "eventTimestamp": 1695203265159,
  "event": {
    "request": {
      "url": "https://cf.js.cool/",
      "method": "GET",
      "headers": {
        "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
        "accept-encoding": "gzip",
        "accept-language": "zh-CN,zh;q=0.8",
        "cache-control": "max-age=0",
        "cf-connecting-ip": "180.111.81.166",
        "cf-connecting-o2o": "1",
        "cf-ipcountry": "CN",
        "cf-ray": "809926170d9fdd1f",
        "cf-visitor": "{\"scheme\":\"https\"}",
        "connection": "Keep-Alive",
        "cookie": "REDACTED",
        "host": "cf.js.cool",
        "priority": "u=0, i",
        "sec-ch-ua": "\"Brave\";v=\"117\", \"Not;A=Brand\";v=\"8\", \"Chromium\";v=\"117\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"macOS\"",
        "sec-fetch-dest": "document",
        "sec-fetch-mode": "navigate",
        "sec-fetch-site": "cross-site",
        "sec-fetch-user": "?1",
        "sec-gpc": "1",
        "upgrade-insecure-requests": "1",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36",
        "x-forwarded-for": "180.111.81.166",
        "x-forwarded-proto": "https",
        "x-real-ip": "180.111.81.166"
      },
      "cf": {
        "longitude": "121.45810",
        "httpProtocol": "HTTP/3",
        "tlsCipher": "AEAD-AES128-GCM-SHA256",
        "continent": "AS",
        "asn": 4134,
        "clientAcceptEncoding": "gzip",
        "country": "CN",
        "tlsClientAuth": {
          "certIssuerDNLegacy": "",
          "certIssuerSKI": "",
          "certSubjectDNRFC2253": "",
          "certSubjectDNLegacy": "",
          "certFingerprintSHA256": "",
          "certNotBefore": "",
          "certSKI": "",
          "certSerial": "",
          "certIssuerDN": "",
          "certVerified": "NONE",
          "certNotAfter": "",
          "certSubjectDN": "",
          "certPresented": "0",
          "certRevoked": "0",
          "certIssuerSerial": "",
          "certIssuerDNRFC2253": "",
          "certFingerprintSHA1": ""
        },
        "tlsVersion": "TLSv1.3",
        "city": "Shanghai",
        "timezone": "Asia/Shanghai",
        "colo": "LHR",
        "edgeRequestKeepAliveStatus": 1,
        "requestPriority": "",
        "latitude": "31.22220",
        "region": "Shanghai",
        "regionCode": "SH",
        "asOrganization": "China Telecom",
        "pagesHostName": "remix-cloudflare-pages-demo-5co.pages.dev",
        "botManagement": {
          "corporateProxy": false,
          "verifiedBot": false,
          "jsDetection": {
            "passed": false
          },
          "staticResource": false,
          "detectionIds": {},
          "score": 99
        }
      }
    },
    "response": {
      "status": 500
    }
  },
  "id": 0
}
image

@willin
Copy link
Author

willin commented Sep 21, 2023

Perhaps it's something about orm.

@rozenmd
Copy link
Contributor

rozenmd commented Sep 25, 2023

Hey @willin - I just looked into the code you posted in drizzle-team/drizzle-orm#1270 - D1 doesn't support transactions nor savepoints in user code (see https://github.com/cloudflare/workerd/blob/e78561270004797ff008f17790dae7cfe4a39629/src/workerd/api/sql-test.js#L252-L253) - Drizzle appears to be using savepoints here.

@rozenmd rozenmd closed this as not planned Won't fix, can't repro, duplicate, stale Sep 25, 2023
@rozenmd rozenmd self-assigned this Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working d1 Relating to D1 pages Relating to Pages
Projects
None yet
Development

No branches or pull requests

3 participants