lizhiyao / sentry-miniapp

Sentry 小程序/小游戏 SDK:用于小程序/小游戏平台的 Sentry SDK(目前支持微信、字节跳动、支付宝、钉钉、QQ、百度小程序,微信、QQ 小游戏)
https://www.npmjs.com/package/sentry-miniapp
BSD 3-Clause "New" or "Revised" License
584 stars 138 forks source link

小程序项目升 Taro 3.0 是编译中提示报错 #35

Closed HeiLiu closed 4 years ago

HeiLiu commented 4 years ago

UnhandledPromiseRejectionWarning: Error: sentry-miniapp 暂不支持此平台

lizhiyao commented 4 years ago

原本在 Taro 3.0 之前的项目中使用时正常的,对吗?

可以提供一个 demo 或者其他相关信息吗? @HeiLiu

HeiLiu commented 4 years ago

对 原来在项目 Taro 2.2.13 中是能够正常使用的、这两天给项目依赖升上 Taro 3.0 编译的时候发现有这个 error、公司的项目有点不好 demo

(node:88534) UnhandledPromiseRejectionWarning: Error: sentry-miniapp 暂不支持此平台 at getSDK (/Users/meicanstaff/Desktop/feWork/paya2/node_modules/sentry-miniapp/src/crossPlatform.ts:61:11) at Object. (/Users/meicanstaff/Desktop/feWork/paya2/node_modules/sentry-miniapp/src/crossPlatform.ts:88:13) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Module._compile (/Users/meicanstaff/Desktop/feWork/paya2/node_modules/pirates/lib/index.js:99:24) at Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Object.newLoader [as .js] (/Users/meicanstaff/Desktop/feWork/paya2/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:986:32) at Function.Module._load (internal/modules/cjs/loader.js:879:14) at Module.require (internal/modules/cjs/loader.js:1026:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (/Users/meicanstaff/Desktop/feWork/paya2/node_modules/sentry-miniapp/src/transports/xhr.ts:3:1) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Module._compile (/Users/meicanstaff/Desktop/feWork/paya2/node_modules/pirates/lib/index.js:99:24) at Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Object.newLoader [as .js] (/Users/meicanstaff/Desktop/feWork/paya2/node_modules/pirates/lib/index.js:104:7) at Module.load (internal/modules/cjs/loader.js:986:32) (node:88534) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3) (node:88534) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

lizhiyao commented 4 years ago
  1. 是微信小程序还是其他平台的小程序?
  2. Taro 3.0 编译的时候,你这边的设置的编译目标平台有哪些呢?

https://github.com/lizhiyao/sentry-miniapp/blob/5fae3ae1040f7c39840909dde41d2e1d979a79a7/src/crossPlatform.ts#L61 根据源码,初步猜测是 Taro 3.0 编译时,在全局找不到 wxmyttddqq 这些变量中的任何一个,就 throw 了 error

HeiLiu commented 4 years ago

我们目前就是编译微信小程序

lizhiyao commented 4 years ago

编译命令使用的是 yarn build:weapp 对吗?

https://nervjs.github.io/taro/docs/GETTING-STARTED#%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8%8B%E5%BA%8F


我本地起了一个用来测试的示例项目,目前执行yarn dev:weappyarn #build:weapp均可以成功。示例项目地址:https://github.com/lizhiyao/taro-example-for-sentry-miniapp

yarn dev:weapp

image

yarn build:weapp

image

开发者工具上,sentry-miniapp 上报异常请求成功发送

image


issue 先关掉了,如果你还有问题我们可以继续交流。