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

部署到wordpress报错DeprecationWarning: OutgoingMessage.prototype._headers is deprecated #92

Open
agczsz opened this issue Jul 13, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@agczsz
Copy link

agczsz commented Jul 13, 2024

你当前使用的Elog版本

0.14.2

Elog配置文件

module.exports = {
  write: {
    platform: 'notion',
    yuque: {
      token: process.env.YUQUE_TOKEN,
      login: process.env.YUQUE_LOGIN,
      repo: process.env.YUQUE_REPO,
      onlyPublic: false,
      onlyPublished: true,
    },
    'yuque-pwd': {
      username: process.env.YUQUE_USERNAME,
      password: process.env.YUQUE_PASSWORD,
      login: process.env.YUQUE_LOGIN,
      repo: process.env.YUQUE_REPO,
      onlyPublic: false,
      onlyPublished: true,
    },
    notion: {
      token: "secret_*oFzC83eOnW"
,
      databaseId: "aa5f58600b34*492"
,
      filter: false, // {property: 'status', select: {equals: 'Published'}}
    },
    feishu: {
      type: 'space',
      wikiId: process.env.FEISHU_WIKI_ID,
      folderToken: process.env.FEISHU_FOLDER_TOKEN,
      appId: process.env.FEISHU_APP_ID,
      appSecret: process.env.FEISHU_APP_SECRET,
    },
    flowus: {
      tablePageId: process.env.FLOWUS_TABLE_PAGE_ID,
      filter: false, // {property: 'status',value: '已发布'}
    },
    wolai: {
      token: process.env.WOLAI_TOKEN,
      pageId: process.env.WOLAI_PAGE_ID,
    }
  },
  deploy: {
    platform: 'wordpress',
    local: {
      outputDir: './docs',
      filename: 'title',
      format: 'markdown',
    },
    halo: {
      endpoint: process.env.HALO_ENDPOINT,
      token: process.env.HALO_TOKEN,
      policyName: process.env.HALO_POLICY_NAME,
      rowType: 'html',
      needUploadImage: true,
    },
    confluence: {
      user: process.env.CONFLUENCE_USER,
      password: process.env.WORDPRESS_PASSWORD,
      endpoint: process.env.WORDPRESS_ENDPOINT,
      spaceKey: process.env.CONFLUENCE_SPACE_KEY,
      rootPageId: process.env.CONFLUENCE_ROOT_PAGE_ID, // 可选
    },
    wordpress: {
      username: "ag*",
      password: "*",
      endpoint: "http://*/wp-json",
    }
  },
  image: {
    enable: false,
    platform: 'local',
    local: {
      outputDir: './docs/images',
      prefixKey: '/images',
      pathFollowDoc: false,
    },
    oss: {
      secretId: process.env.OSS_SECRET_ID,
      secretKey: process.env.OSS_SECRET_KEY,
      bucket: process.env.OSS_BUCKET,
      region: process.env.OSS_REGION,
      host: process.env.OSS_HOST,
      prefixKey: '',
    },
    cos: {
      secretId: process.env.COS_SECRET_ID,
      secretKey: process.env.COS_SECRET_KEY,
      bucket: process.env.COS_BUCKET,
      region: process.env.COS_REGION,
      host: process.env.COS_HOST,
      prefixKey: '',
    },
    qiniu: {
      secretId: process.env.QINIU_SECRET_ID,
      secretKey: process.env.QINIU_SECRET_KEY,
      bucket: process.env.QINIU_BUCKET,
      region: process.env.QINIU_REGION,
      host: process.env.QINIU_HOST,
      prefixKey: '',
    },
    upyun: {
      user: process.env.UPYUN_USER,
      password: process.env.UPYUN_PASSWORD,
      bucket: process.env.UPYUN_BUCKET,
      host: process.env.UPYUN_HOST,
      prefixKey: '',
    },
    github: {
      token: process.env.GITHUB_TOKEN,
      user: process.env.ELOG_GITHUB_USER,
      repo: process.env.ELOG_GITHUB_REPO,
      prefixKey: '',
    }
  }
}

发生了什么?

使用了nodejs 20.15
这个警告消息 (node:737361) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated 是 Node.js 发出的,表示 OutgoingMessage.prototype._headers 属性已经被弃用。这个属性用于访问 HTTP 响应头信息,但在较新的 Node.js 版本中已经不推荐使用,并且可能会在未来的版本中被移除。
已下载数 46
正在部署到 WordPress...
(node:782112) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use node --trace-deprecation ... to show where the warning was created)

Elog错误日志

已下载数  46
正在部署到 WordPress...
(node:782112) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
部署到 WordPress 失败: Cannot read properties of undefined (reading 'rendered')

附加信息

来自gpt:更新代码以使用推荐的替代方法:

使用 OutgoingMessage.getHeaders() 来替代访问 _headers 属性。
检查和更新依赖项:

确保你的项目依赖项(如 Express 或其他 HTTP 相关库)已经更新到最新版本,这些库可能已经修复了对 _headers 属性的使用。
使用 npm outdated 检查哪些依赖项是过时的,然后运行 npm update 进行更新。

@agczsz agczsz added the bug Something isn't working label Jul 13, 2024
@LetTTGACO
Copy link
Owner

抱歉,wordpress 的维护会在晚些时候修复,我的 wordpress 站点出了点问题。

@LetTTGACO
Copy link
Owner

感谢提供的线索,我会尽量在本月进行修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants