sentry-javascript: Sentry.captureException is not a function
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using? If you use the CDN bundles, please specify the exact bundle (e.g. bundle.tracing.min.js) in your SDK setup.
SDK Version
7.43.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
import * as Sentry from '@sentry/serverless'
Sentry.GCPFunction.init({
dsn: '',
environment: process.env.NODE_ENV,
})
Steps to Reproduce
Sentry.captureException(new Error(‘test’))
Expected Result
Don’t crash
Actual Result
Crash
TypeError: Sentry.captureException is not a function
at file:///Users/maxpain/dev/gptaskbot/src/index.ts:64:8
at processTicksAndRejections (node:internal/process/task_queues:95:5)
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 26 (13 by maintainers)
@KarelVendla please open a new GH issue - we need more details around SDK version and nuxt/vite version to help debug.
@maxpain fix is merged, will be part of the next SDK release. In the meantime, you can fall back to importing and using the
@sentry/nodepackage (since the serverless package just wraps that under the hood).Again, appreciate the help debugging, couldn’t have figured it out without your help!
Thanks!
Thanks for sticking with me @maxpain and helping debug, appreciate the help a lot!
I wonder now how we should solve this 🤔.
Is there a good way to mix namespace imports while preserving the wildcard export of the node package.
It is causing issues! It’s causing the node exports to go under
default