tangly1024 / NotionNext

使用 NextJS + Notion API 实现的,支持多种部署方案的静态博客,无需服务器、零门槛搭建网站,为Notion和所有创作者设计。 (A static blog built with NextJS and Notion API, supporting multiple deployment options. No server required, zero threshold to set up a website. Designed for Notion and all creators.)
https://tangly1024.com
MIT License
7.88k stars 10.83k forks source link

评论部署后,发表评论报错,帮忙定位一下 #308

Closed sunnydongbowen closed 2 years ago

sunnydongbowen commented 2 years ago

描述遇到的问题 按照部署文档部署了评论,提交评论时报错,具体报错见截图,无法发表评论,大佬帮忙定位一下。

相应配置 这是我的博客环境,可以在下面评论提交,看一下前端报错 https://bovan.vercel.app/article/8f392d85-2510-455e-99fd-74bb780adebd 截图 image 控制台报错如下 image

环境

tangly1024 commented 2 years ago

Hi,我看了一下,你的地址配置错啦;

  1. 首先确认你已经部署了一个waline服务,并且能正常打开访问,例如我的是:https://waline.tangly1024.com(评论结尾不要斜杆)。

  2. 在NotionNext的Vercel后台配置环境变量: NEXT_PUBLIC_WALINE_SERVER_URL ,值就是上一步中的waline服务地址,如图:

    图片
  3. Redelpoy你的NotionNext项目即可生效

    图片
sunnydongbowen commented 2 years ago

这个url应该是哪个url啊,是下面截图这里面的吗。 image

tangly1024 commented 2 years ago

1.点此链接在你的Vercel中部署一个Waline服务。

  1. 在Waline的Vercel后台中添加环境变量,配置以下三个环境变量 LEAN_ID, LEAN_KEY 和 LEAN_MASTER_KEY 。 它们的值分别对应LeanCloud 中获得的 APP ID, APP KEY, Master Key。
  2. redeploy你的waline项目,使配置生效。
  3. 部署完成在vercel中可以找到访问链接,点击Visit或者,点击Domains下的域名 图片
sunnydongbowen commented 2 years ago

好像没法部署了,得手动建仓库吗,自动建的好像不大行 image

tangly1024 commented 2 years ago

再重新点一下试试,可能是这个仓库的配置有问题,我刚刚调整了

sunnydongbowen commented 2 years ago

可以了,但是我添加了环境变量后,重新部署后出现了这个。。。 image

tangly1024 commented 2 years ago

似乎是部署出错,请提供一下部署的日志

sunnydongbowen commented 2 years ago

这是日志,部署是成功的啊,没有报错。


[14:11:15.421] Cloning github.com/sunnydongbowen/Bovan-Waline (Branch: main, Commit: fcd422b)
[14:11:15.955] Cloning completed: 533.543ms
[14:11:16.007] Warning: Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
[14:11:16.050] Installing build runtime...
[14:11:17.395] Build runtime installed: 1.344s
[14:11:18.845] No Build Cache available
[14:11:19.574] Installing dependencies...
[14:11:20.005] yarn install v1.22.17
[14:11:20.047] info No lockfile found.
[14:11:20.056] [1/4] Resolving packages...
[14:11:21.353] warning @waline/vercel > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[14:11:21.354] warning @waline/vercel > akismet > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[14:11:21.361] warning @waline/vercel > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
[14:11:21.643] warning @waline/vercel > @cloudbase/node-sdk > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[14:11:22.128] warning @waline/vercel > leancloud-storage > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[14:11:22.129] warning @waline/vercel > request > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[14:11:22.129] warning @waline/vercel > think-helper > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[14:11:22.129] warning @waline/vercel > leancloud-storage > leancloud-realtime > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[14:11:22.189] warning @waline/vercel > request > har-validator@5.1.5: this library is no longer supported
[14:11:22.597] warning @waline/vercel > @cloudbase/node-sdk > request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
[14:11:23.057] warning @waline/vercel > leancloud-storage > babel-runtime > core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
[14:11:23.311] warning @waline/vercel > thinkjs > think-resource > think-helper > uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
[14:11:23.382] warning @waline/vercel > think-model-sqlite > sqlite3 > node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
[14:11:23.728] warning @waline/vercel > thinkjs > think-payload > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
[14:11:23.983] warning @waline/vercel > leancloud-storage > @leancloud/platform-adapters-browser > @leancloud/adapters-superagent > superagent@5.3.1: Please upgrade to v7.0.2+ of superagent.  We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing.  See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
[14:11:23.986] warning @waline/vercel > leancloud-storage > @leancloud/platform-adapters-browser > @leancloud/adapters-superagent > superagent > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
[14:11:23.999] warning @waline/vercel > @cloudbase/node-sdk > @cloudbase/signature-nodejs > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
[14:11:24.424] [2/4] Fetching packages...
[14:11:34.918] [3/4] Linking dependencies...
[14:11:34.921] warning "@waline/vercel > @cloudbase/node-sdk > ts-node@8.10.2" has unmet peer dependency "typescript@>=2.7".
[14:11:39.424] [4/4] Building fresh packages...
[14:12:36.372] success Saved lockfile.
[14:12:36.378] Done in 76.38s.
[14:12:58.836] Generated build outputs:
[14:12:58.836]  - Static files: 0
[14:12:58.836]  - Serverless Functions: 1
[14:12:58.836]  - Edge Functions: 0
[14:12:58.836] Serverless regions: Washington, D.C., USA
[14:12:58.836] Deployed outputs in 3s
[14:13:01.387] Build completed. Populating build cache...
[14:13:13.432] Uploading build cache [37.42 MB]...
[14:13:15.203] Build cache uploaded: 1.771s
[14:13:15.241] Done with "index.js"
tangly1024 commented 2 years ago

可以了,但是我添加了环境变量后,重新部署后出现了这个。。。 image

点击 图中的 check the logs 访问运行日志界面,刷新一下你的waline站点获取最新错误日志;

图片
sunnydongbowen commented 2 years ago

看了一下,是这个报错


[GET] /
15:28:39:18
Error: Cannot find module '/var/task/node_modules/sqlite3/lib/binding/node-v93-linux-x64/node_sqlite3.node'
Require stack:
- /var/task/node_modules/sqlite3/lib/sqlite3-binding.js
- /var/task/node_modules/sqlite3/lib/sqlite3.js
- /var/task/node_modules/think-model-sqlite/lib/socket.js
- /var/task/node_modules/think-model-sqlite/lib/query.js
- /var/task/node_modules/think-model-sqlite/index.js
- /var/task/node_modules/@waline/vercel/src/config/adapter.js
- /var/task/node_modules/think-loader/loader/config.js
- /var/task/node_modules/think-loader/index.js
- /var/task/node_modules/thinkjs/lib/loader.js
- /var/task/node_modules/thinkjs/lib/application.js
- /var/task/node_modules/@waline/vercel/index.js
- /var/task/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/var/task/node_modules/sqlite3/lib/sqlite3-binding.js:4:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/sqlite3/lib/sqlite3-binding.js',
    '/var/task/node_modules/sqlite3/lib/sqlite3.js',
    '/var/task/node_modules/think-model-sqlite/lib/socket.js',
    '/var/task/node_modules/think-model-sqlite/lib/query.js',
    '/var/task/node_modules/think-model-sqlite/index.js',
    '/var/task/node_modules/@waline/vercel/src/config/adapter.js',
    '/var/task/node_modules/think-loader/loader/config.js',
    '/var/task/node_modules/think-loader/index.js',
    '/var/task/node_modules/thinkjs/lib/loader.js',
    '/var/task/node_modules/thinkjs/lib/application.js',
    '/var/task/node_modules/@waline/vercel/index.js',
    '/var/task/index.js'
  ]
}
2022-06-16T07:28:43.593Z    undefined   ERROR   TypeError: serverURL option is required for apps from CN region
    at Object.init (/var/task/node_modules/leancloud-storage/dist/node/init.js:99:13)
    at Object.<anonymous> (/var/task/node_modules/@waline/vercel/src/service/storage/leancloud.js:7:6)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at exports.interopRequire (/var/task/node_modules/think-loader/loader/util.js:14:13)
    at /var/task/node_modules/think-loader/loader/common.js:16:26
RequestId: 4970c2bb-d721-423e-a9b3-3e565c829318 Error: Runtime exited with error: exit status 1
Runtime.ExitError
[GET] /
15:27:57:28
Error: Cannot find module '/var/task/node_modules/sqlite3/lib/binding/node-v93-linux-x64/node_sqlite3.node'
Require stack:
- /var/task/node_modules/sqlite3/lib/sqlite3-binding.js
- /var/task/node_modules/sqlite3/lib/sqlite3.js
- /var/task/node_modules/think-model-sqlite/lib/socket.js
- /var/task/node_modules/think-model-sqlite/lib/query.js
- /var/task/node_modules/think-model-sqlite/index.js
- /var/task/node_modules/@waline/vercel/src/config/adapter.js
- /var/task/node_modules/think-loader/loader/config.js
- /var/task/node_modules/think-loader/index.js
- /var/task/node_modules/thinkjs/lib/loader.js
- /var/task/node_modules/thinkjs/lib/application.js
- /var/task/node_modules/@waline/vercel/index.js
- /var/task/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/var/task/node_modules/sqlite3/lib/sqlite3-binding.js:4:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/sqlite3/lib/sqlite3-binding.js',
    '/var/task/node_modules/sqlite3/lib/sqlite3.js',
    '/var/task/node_modules/think-model-sqlite/lib/socket.js',
    '/var/task/node_modules/think-model-sqlite/lib/query.js',
    '/var/task/node_modules/think-model-sqlite/index.js',
    '/var/task/node_modules/@waline/vercel/src/config/adapter.js',
    '/var/task/node_modules/think-loader/loader/config.js',
    '/var/task/node_modules/think-loader/index.js',
    '/var/task/node_modules/thinkjs/lib/loader.js',
    '/var/task/node_modules/thinkjs/lib/application.js',
    '/var/task/node_modules/@waline/vercel/index.js',
    '/var/task/index.js'
  ]
}
2022-06-16T07:28:01.755Z    undefined   ERROR   TypeError: serverURL option is required for apps from CN region
    at Object.init (/var/task/node_modules/leancloud-storage/dist/node/init.js:99:13)
    at Object.<anonymous> (/var/task/node_modules/@waline/vercel/src/service/storage/leancloud.js:7:6)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at exports.interopRequire (/var/task/node_modules/think-loader/loader/util.js:14:13)
    at /var/task/node_modules/think-loader/loader/common.js:16:26
RequestId: a38066d5-aaf3-4168-8c72-9a2877bbbf5a Error: Runtime exited with error: exit status 1
Runtime.ExitError
tangly1024 commented 2 years ago

根据官网描述:

图片

出现这种报错原因是你使用的是国内版的LeanCloud账号,所以需要加一个配置:

LEAN_SERVER 值为你访问的域名。

sunnydongbowen commented 2 years ago

感谢大佬,现在可以访问了,但是评论提交报这个错误,这是哪边配置不对吗


[GET] /1.1/classes/Comment?where=%7B%22url%22%3A%22%2F%22%2C%22mail%22%3A%22%22%2C%22nick%22%3A%22%E5%8C%BF%E5%90%8D%22%2C%22link%22%3A%22%22%2C%22comment%22%3A%22%E6%B5%8B%E8%AF%95%E4%B8%80%E4%B8%8B%22%7D
16:30:47:34
2022-06-16T08:30:47.460Z    3dceee89-8b2b-4bab-a434-5401ce184af5    ERROR   NotFoundError: url `/1.1/classes/Comment` not found.
    at Object.throw (/var/task/node_modules/koa/lib/context.js:97:11)
    at /var/task/node_modules/think-trace/lib/index.js:33:23
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at cors (/var/task/node_modules/@koa/cors/index.js:60:32)
    at /var/task/node_modules/@waline/vercel/src/middleware/version.js:5:3
    at Server.<anonymous> (/var/task/___vc/__helpers.js:813:13)
[POST] /comment?lang=null
16:30:46:68
[2022-06-16T08:30:47.282] [9] [DEBUG]
 - Post Comment Start!
[2022-06-16T08:30:47.283] [9] [DEBUG]
 - Post Comment initial Data: {
  link: '',
  mail: '',
  nick: '匿名',
  pid: undefined,
  rid: undefined,
  ua: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36',
  url: '/',
  comment: '测试一下',
  ip: '117.89.194.71',
  insertedAt: 2022-06-16T08:30:47.283Z,
  user_id: undefined
}
[2022-06-16T08:30:47.283] [9] [DEBUG]
 - Comment IP 117.89.194.71 check OK!
2022-06-16T08:30:47.509Z    32c480d9-b258-4aba-8355-a30c02cce3d0    ERROR   Error: undefined [404 GET https://bovan-waline.vercel.app/1.1/classes/Comment]
    at /var/task/node_modules/leancloud-storage/dist/node/request.js:169:17
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at module.exports._select (/var/task/node_modules/@waline/vercel/src/service/storage/leancloud.js:107:18)
    at module.exports.select (/var/task/node_modules/@waline/vercel/src/service/storage/leancloud.js:122:13)
    at module.exports.postAction (/var/task/node_modules/@waline/vercel/src/controller/comment.js:461:25)
    at cors (/var/task/node_modules/@koa/cors/index.js:107:16)
    at /var/task/node_modules/@waline/vercel/src/middleware/version.js:5:3
    at Server.<anonymous> (/var/task/___vc/__helpers.js:813:13) {
  code: -1,
  rawMessage: undefined
}
[GET] /1.1/classes/Comment?where=%7B%22url%22%3A%22%2F%22%2C%22mail%22%3A%22%22%2C%22nick%22%3A%22%E5%8C%BF%E5%90%8D%22%2C%22link%22%3A%22%22%2C%22comment%22%3A%22%E6%B5%8B%E8%AF%95%E4%B8%80%E4%B8%8B%22%7D
16:29:48:68
2022-06-16T08:29:48.702Z    61432935-d4b8-4934-bbbe-a33602e6b95d    ERROR   NotFoundError: url `/1.1/classes/Comment` not found.
    at Object.throw (/var/task/node_modules/koa/lib/context.js:97:11)
    at /var/task/node_modules/think-trace/lib/index.js:33:23
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at cors (/var/task/node_modules/@koa/cors/index.js:60:32)
    at /var/task/node_modules/@waline/vercel/src/middleware/version.js:5:3
    at Server.<anonymous> (/var/task/___vc/__helpers.js:813:13)
sunnydongbowen commented 2 years ago

暂时已解决,我换成国际版的就可以了。万分感谢!