Open krisdages opened 3 years ago
+1 on this The typescript definition does not report an error but it's indeed broken
Same goes for @sentry/serverless
. Search terms:
Cannot read property 'GCPFunction' of undefined
@rbisol Why is this not a bug. It basically makes this library unusable when you are working in an environment requiring interop?
I’ve ran into this problem as well. Since we are using dependency injection we almost shipped a broken version of our app to production.
FWIW, if I remove this line from the commonJS module:
Object.defineProperty(exports, "__esModule", { value: true });
, it works as expected
any news?
@imsamurai is this still an issue with the newest version of the SDK? We updated how we bundle the SDK in version 7.x.x
.
still a problem, no default export
This is still a problem. Is there any fix in the works? This is incredibly dangerous especially for a module that tends to be used as part of error handling. Its very easy for this to go unnoticed until a bug causes a new exception. As an example, Sentry.captureException
will generally only be called in "exceptional" circumstances and you may not have comprehensive tests for every place you call Sentry.captureException
. But its a big problem for that call to fail as it breaks error reporting and causes an entirely different error in error handling code
HI @amc6,
could you share more details in how you ran into this? We do not document import Sentry from '@sentry/xxx'
anywhere (because it does not work), and our TS setup should be setup properly - it is not incorrect to have no default export in ESM, as far as I can tell.
So could you share:
@mydea I did some digging around this issue a while ago and I think we have to play around with enableLegacyTypeScriptModuleInterop.
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
This is still an issue, the issue can stay open
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Even though we are not working on this right now, we still shouldn't close it. The issue has 20 thumbs.
Relates to PR https://github.com/getsentry/sentry-javascript/pull/3077
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
Sentry must be imported using
import * as Sentry
instead ofimport Sentry
in order to work. With the esModuleInterop compiler option enabled, TypeScript does not complain aboutimport Sentry
. (With the option off, TS recognizes that the module does not have a default import and forbidsimport Sentry
)This appears to be because the Sentry index.js module declares
__esModule: true
but does not actually have a value for the default export:Can the library be updated so the default import works as TypeScript thinks it does? This is only an issue when the esModuleInterop setting is on, but it's a pretty valuable setting and a dangerous mistake for the developer.
Thanks!