
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@stonekeys/sentry-miniapp
Advanced tools
用于小程序平台的 Sentry SDK
ES6、CommonJS 两种模块系统(支持小程序原生开发方式、使用小程序框架开发方式两种开发模式下使用)支持两种使用方式:
Sentry Service,比如:使用 官方 Sentry Service 服务 或自己搭建 Sentry Service。如果想直接将异常信息上报到 https://sentry.io/,由于其没有备案,可以先将异常信息上报给自己已备案域名下的服务端接口,由服务端进行请求转发。Sentry Service 对应的 request 合法域名/examples 中各项目使用方式,将 sentry-miniapp.xx.min.js 放入项目的合适目录中,比如放入 vendor 文件夹/examples/app.js 代码,进行 Sentry 的初始化sentry-miniapp 会自动上报 xx.onError() 捕获的异常,对于支付宝小程序需要应用开发者在 App.onError() 中主动进行异常上报。详情可见 /docs/cross-platform.md。注意:目前字节跳动小程序不支持 npm 方式。
安装依赖
npm install sentry-miniapp --save
# 或者
yarn add sentry-miniapp
使用「微信开发者工具 - 工具 - 构建 npm」进行构建,详情可参考npm 支持
在 app.js 中引用并初始化 Sentry,根据实际需求设置上报到 Sentry 的元信息
import * as Sentry from "sentry-miniapp";
// init Sentry
// init options: https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/options.ts
Sentry.init({
dsn: "__DSN__",
// ...
});
// Set user information, as well as tags and further extras
Sentry.configureScope((scope) => {
scope.setExtra("battery", 0.7);
scope.setTag("user_mode", "admin");
scope.setUser({ id: "4711" });
// scope.clear();
});
// Add a breadcrumb for future events
Sentry.addBreadcrumb({
message: "My Breadcrumb",
// ...
});
// Capture exceptions, messages or manual events
Sentry.captureException(new Error("Good bye"));
Sentry.captureMessage("Hello, world!");
Sentry.captureEvent({
message: "Manual",
stacktrace: [
// ...
],
});
开发前请仔细阅读下面内容:



# 根据 package.json 中的版本号更新 SDK 源码中的版本号
npm run version
# 构建供小程序直接引用的 sentry-miniapp.xx.min.js;在本地可直接使用开发者工具打开 examples 下具体项目进行调试
npm run build:dist
# 构建供微信小程序直接引用的 sentry-miniapp.wx.min.js
npm run build:wx
# 构建供支付宝小程序直接引用的 sentry-miniapp.my.min.js
npm run build:my
# 构建供钉钉小程序直接引用的 sentry-miniapp.dd.min.js
npm run build:dd
# 构建供字节跳动小程序直接引用的 sentry-miniapp.tt.min.js
npm run build:tt
# 构建供百度小程序直接引用的 sentry-miniapp.swan.min.js
npm run build:swan
# 构建用于发布到 npm 的 dist 资源
npm run build
# 构建用于发布到 npm 的 esm 资源
npm run build:esm
# 发布到 npm
npm publish --registry=https://registry.npmjs.org/

欢迎通过 issue、pull request等方式贡献 sentry-miniapp。
PS. 由于微信群二维码有时效性限制,想入群的同学还可以加作者微信(添加时请备注 sentry-miniapp),由作者邀请入群

FAQs
用于小程序/小游戏平台的 Sentry SDK
We found that @stonekeys/sentry-miniapp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.