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

[D1_ERROR] Cloudflare Worker Threw Exception #68

Open
kylemclaren opened this issue Apr 6, 2023 · 1 comment
Open

[D1_ERROR] Cloudflare Worker Threw Exception #68

kylemclaren opened this issue Apr 6, 2023 · 1 comment

Comments

@kylemclaren
Copy link

Issue Summary

After deploying my workflow and verifying that all secrets were valid, I tried to access the CF Pages site but got a 500 error instead. I looked at the CF Pages logs and saw that there was a D1 error. I checked D1 and found that no tables had been created. I ran the init.sql statement manually and that fixed the problem. I'm not sure if this is a bug or if I missed something.

{
  "outcome": "exception",
  "scriptName": "pages-worker--980544-production",
  "exceptions": [
    {
      "name": "Error",
      "message": "D1_ERROR",
      "timestamp": 1680774207584
    }
  ],
...

Steps to Reproduce

  1. Deploy the workflow and make sure all secrets are valid.
  2. Try to access the CF Pages site.
  3. See the 500 error and check the CF Pages logs.
  4. Find the D1 error in the logs and check D1 for missing tables.
  5. Run the init.sql statement manually.
  6. Verify that the CF Pages site is accessible after running the init.sql statement.

Expected Behavior

The CF Pages site should be accessible without any issues after a successful deployment.

Actual Behavior

The CF Pages site returns a 500 error and the CF Pages logs show a D1 error due to missing tables.

Possible Solution/Workaround

Manually running the init.sql statement in the CF D1 console resolved the problem. It's possible that the statement wasn't executed during the deployment process, which caused the missing tables and D1 error.

@kylemclaren
Copy link
Author

Had a chance to look at the workflow run now and I see the issue in this job:

✘ [ERROR] A request to the Cloudflare API (/accounts/***/d1/database/***/query) failed.

  Internal error [code: 7501]
  
  If you think this is a bug, please open an issue at: https://github.com/cloudflare/workers-sdk/issues/new/choose

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

No branches or pull requests

1 participant