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

@sentry/serverless #7421

Closed
3 tasks done
revmischa opened this issue Mar 11, 2023 · 1 comment · Fixed by #7430
Closed
3 tasks done

@sentry/serverless #7421

revmischa opened this issue Mar 11, 2023 · 1 comment · Fixed by #7430
Assignees

Comments

@revmischa
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

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.

@sentry/serverless

SDK Version

7.42.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

import { AWSLambda } from '@sentry/serverless';
import { Handler } from 'aws-lambda';
import { getSstStage } from 'common';

if (process.env['_HANDLER']) {
  AWSLambda.init({
    environment: getSstStage(),
    maxBreadcrumbs: 30,
    debug: false,
  });
}

export function wrapSentry(fn: Handler) {
  return AWSLambda.wrapHandler(fn);
}

const handler = middy(wrapSentry(resolverFunc))

Steps to Reproduce

Wrap a handler in the latest sentry/serverless AWSLambda.wrapHandler
I'm using appSync resolver lambda functions

Expected Result

Don't throw this error 👇🏻 when I invoke the function

Actual Result

TypeError: Cannot assign to read only property 'get' of object '[object Module]'
    at fill (/node_modules/.pnpm/@sentry+utils@7.42.0/node_modules/@sentry/src/object.ts:39:1)
    at Http.setupOnce (/node_modules/.pnpm/@sentry+node@7.42.0/node_modules/@sentry/src/integrations/http.ts:105:1)
    at setupIntegration (/node_modules/.pnpm/@sentry+core@7.42.0/node_modules/@sentry/src/integration.ts:105:1)
    at <anonymous> (/node_modules/.pnpm/@sentry+core@7.42.0/node_modules/@sentry/src/integration.ts:93:1)
    at Array.forEach (<anonymous>)
    at setupIntegrations (/node_modules/.pnpm/@sentry+core@7.42.0/node_modules/@sentry/src/integration.ts:90:1)
    at NodeClient.setupIntegrations (/node_modules/.pnpm/@sentry+core@7.42.0/node_modules/@sentry/src/baseclient.ts:273:1)
    at Hub.bindClient (/node_modules/.pnpm/@sentry+core@7.42.0/node_modules/@sentry/src/hub.ts:124:1)
    at initAndBind (/node_modules/.pnpm/@sentry+core@7.42.0/node_modules/@sentry/src/sdk.ts:36:1)
    at init (/node_modules/.pnpm/@sentry+node@7.42.0/node_modules/@sentry/src/sdk.ts:170:1)
@Lms24
Copy link
Member

Lms24 commented Mar 13, 2023

Hi @revmischa thanks for reporting! This is likely caused by #7377 which we included in 7.42.0. It was also reported in #7425 . We're working on a fix which we'll release in the next version.

@Lms24 Lms24 self-assigned this Mar 13, 2023
Lms24 added a commit that referenced this issue Mar 13, 2023
…7430)

Partially revert #7377 which caused monkey patching errors when patching the native `http` and `https` modules in the Node SDK (#7425). Similarly, also our Serverless SDK was subjected to the same problem (#7421). 

The problem is that `import` doesn't permit monkey patching of the imported (`http(s)`) module, producing this error:

```bash
TypeError: Cannot assign to read only property 'get' of object '[object Module]'
```

I tried using a dynamic import instead but got the same result. So it seems like we can only use `require` here :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants