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

Failed in Node.js 16 #3601

Closed
4 of 9 tasks
hongbo-miao opened this issue May 26, 2021 · 2 comments
Closed
4 of 9 tasks

Failed in Node.js 16 #3601

hongbo-miao opened this issue May 26, 2021 · 2 comments

Comments

@hongbo-miao
Copy link

hongbo-miao commented May 26, 2021

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

6.4.1

Description

Use Node.js 16.2.0 (latest version writing this), and simply use the demo at
https://docs.sentry.io/platforms/node/guides/express/

import express from "express";
import * as Sentry from "@sentry/node";

// or using CommonJS
// const express = require('express');
// const Sentry = require('@sentry/node');

const app = express();

Sentry.init({ dsn: "https://examplePublicKey@o0.ingest.sentry.io/0" });

// The request handler must be the first middleware on the app
app.use(Sentry.Handlers.requestHandler());

// All controllers should live here
app.get("/", function rootHandler(req, res) {
  res.end("Hello world!");
});

// The error handler must be before any other error middleware and after all controllers
app.use(Sentry.Handlers.errorHandler());

// Optional fallthrough error handler
app.use(function onError(err, req, res, next) {
  // The error id is attached to `res.sentry` to be returned
  // and optionally displayed to the user for support.
  res.statusCode = 500;
  res.end(res.sentry + "\n");
});

app.listen(3000);

The server can start successfully, however, if hit any endpoint such as going to http://localhost:3000 in this case, the server will crash with error

/Users/hm/.nvm/versions/node/v16.2.0/bin/node[89516]: ../src/api/callback.cc:125:void node::InternalCallbackScope::Close(): Assertion `(env_->execution_async_id()) == (0)' failed.
 1: 0x10ebbf7e5 node::Abort() (.cold.1) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 2: 0x10d872b39 node::Abort() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 3: 0x10d8729a1 node::Assert(node::AssertionInfo const&) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 4: 0x10d7a2cdd node::InternalCallbackScope::Close() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 5: 0x10d7a25de node::InternalCallbackScope::~InternalCallbackScope() [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 6: 0x10d813b88 node::Environment::RunTimers(uv_timer_s*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 7: 0x10e267877 uv__run_timers [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 8: 0x10e26c0ad uv_run [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
 9: 0x10d7a3ea4 node::SpinEventLoop(node::Environment*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
10: 0x10d8b4414 node::NodeMainInstance::Run(node::EnvSerializeInfo const*) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
11: 0x10d84097d node::Start(int, char**) [/Users/hm/.nvm/versions/node/v16.2.0/bin/node]
12: 0x7fff2057a621 start [/usr/lib/system/libdyld.dylib]
13: 0x7

I located, without line app.use(Sentry.Handlers.requestHandler());, it won't have this issue.

@hongbo-miao hongbo-miao changed the title Faile Failed in Node.js 16 May 26, 2021
@kamilogorek
Copy link
Contributor

Duplicate of #3585

@kamilogorek kamilogorek marked this as a duplicate of #3585 May 26, 2021
@hongbo-miao
Copy link
Author

Thanks @kamilogorek !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants