发布于: -/最后更新: -/4 分钟/

搭建同款博客网站

摘要

搭建个人博客过程中遇到的问题及解决方案。主要问题包括构建失败和Internal Server Error。构建失败是由于域名已有DNS记录,解决方案是删除这些记录。Internal Server Error是由于运行时配置有误或不存在,解决方案是检查变量和机密配置是否正确。另外,文章发布支持定时发布,可能导致看不到发布后的文章,解决方案是修改发布时间或等待到发布时间。

说明

本站搭建参考自:

【零成本搭建一个自己的个人博客,还带CMS?Cloudflare的恩情还不完!】 https://www.bilibili.com/video/BV1X364BcE7a/?share_source=copy_web&vd_source=860f2b55b19d46a6df5c52b845497675

参考教程:

https://blog.dukda.com/post/flare-stack-blog%E9%83%A8%E7%BD%B2%E6%95%99%E7%A8%8B

GitHub仓库:https://github.com/du2333/flare-stack-blog

后续内容只是对参考教程的补充说明。

强烈建议查看后续内容后再对照参考教程进行操作!

搭建过程中遇到的问题及解决

后续内容中,若无特殊说明,出现的域名、IP等内容请以你自己的为准!

例如:删除faito.top的所有DNS记录。这里删除DNS记录时应是删除你自己域名的DNS记录,而不是faito.top。

构建失败

构建失败上下文

构建日志->正在部署到 Cloudflare 全球网络失败:

09:23:17.803

Uploaded flare-stack-blog (18.12 sec)

09:23:20.284

09:23:20.287

✘ [ERROR] A request to the Cloudflare API (/accounts/85db56a9bb93exxxx8a5225e2a1681/workers/scripts/flare-stack-blog/domains/records) failed.

09:23:20.287

09:23:20.287

Hostname 'faito.top' already has externally managed DNS records (A, CNAME, etc). Either delete them, try a different hostname, or use the option 'override_existing_dns_record' to override. [code: 100117]

09:23:20.287

09:23:20.287

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

09:23:20.287

09:23:20.287

09:23:20.313

🪵 Logs were written to "/opt/buildhome/.config/.wrangler/logs/wrangler-2026-02-06_01-22-58_580.log"

09:23:20.354

error: script "deploy" exited with code 1

09:23:20.359

Failed: error occurred while running deploy command

构建失败日志关键点

Hostname 'faito.top' already has externally managed DNS records (A, CNAME, etc). Either delete them, try a different hostname, or use the option 'override_existing_dns_record' to override. [code: 100117]

构建失败原因

域名:faito.top已有DNS记录。部署时会将博客网站与该域名进行绑定,因此此时不允许faito.top有其他DNS解析记录。

构建失败解决方案

将faito.top的A、CNAME等记录全部删除。

Internal Server Error

Error上下文

访问博客域名,页面显示Internal Server Error,控制台报500错。

Workers 和 Pages->Observability错误日志:

2026-02-06 10:11:51:070GMT+8

log

Invalid environment variables:

JSX
{
  "errors": [],
  "level": "error",
  "message": "Invalid environment variables:",
  "properties": {
    "BETTER_AUTH_SECRET": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "BETTER_AUTH_URL": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "ADMIN_EMAIL": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "GITHUB_CLIENT_ID": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "GITHUB_CLIENT_SECRET": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "CLOUDFLARE_ZONE_ID": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "CLOUDFLARE_PURGE_API_TOKEN": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "DOMAIN": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    }
  },
  "$workers": {
    "truncated": false,
    "event": {
      "request": {
        "url": "https://faito.top/",
        "method": "GET",
        "path": "/"
      }
    },
    "outcome": "ok",
    "scriptName": "flare-stack-blog",
    "eventType": "fetch",
    "executionModel": "stateless",
    "scriptVersion": {
      "id": "e475afc3-7d4b-4e0f-811a-016f5ab602db"
    },
    "requestId": "9c971e81c8f561ec"
  },
  "$metadata": {
    "id": "01KGRBGKMYXJ516RS5NHS1VW4R",
    "requestId": "9c971e81c8f561ec",
    "trigger": "GET /",
    "service": "flare-stack-blog",
    "level": "error",
    "error": "Invalid environment variables:",
    "message": "Invalid environment variables:",
    "account": "85db56a9bb93e9495018a5225e2a1681",
    "type": "cf-worker",
    "fingerprint": "7e376f5943bb92097f4075f069a2631f",
    "origin": "fetch",
    "messageTemplate": "Invalid environment variables:"
  }
}

报错关键点

JSX
"properties": {
    "BETTER_AUTH_SECRET": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "BETTER_AUTH_URL": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "ADMIN_EMAIL": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "GITHUB_CLIENT_ID": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "GITHUB_CLIENT_SECRET": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "CLOUDFLARE_ZONE_ID": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "CLOUDFLARE_PURGE_API_TOKEN": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    },
    "DOMAIN": {
      "errors": [
        "Invalid input: expected string, received undefined"
      ]
    }
  }

报错原因

运行时配置有误或不存在。

Error解决方案

查看变量和机密(为运行时使用的 Worker 定义环境变量和机密)是否有相关配置条目,且配置正确(首字母自动转换成大写可能会导致配置错误)。若变量和机密栏目下无内容,则表示没有进行任何运行时配置。

注意

ADMIN_EMAIL建议配置为登录cloudflare的邮箱。

GitHub的主邮箱也推荐使用这里所配置的,因为后续使用GitHub登录时读取到的邮箱会是这个。如果你是博客的管理者而不这样做的话将会导致你在使用GitHub登录时的权限为读者,因为你的登录邮箱不是ADMIN_EMAIL所配置的

看不到发布后的文章

看不到发布后的文章原因

以下内容为推测,实际原因请联系项目作者

文章发布是支持定时发布的,也就是说只有当前时间晚于发布时间文章才会被发布。

例如:当前为26年1月2日,那么发布时间应为26年1月1日文章才会被发布。

看不到发布后的文章解决方案

发布时间修改为当前时间的前一天,或等明天再来查看文章。

正文结束