Skip to content

self._mergeOptions is not a function with Strapi v4 #4956

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

Closed
SujayPrabhu96 opened this issue Apr 18, 2022 · 17 comments
Closed

self._mergeOptions is not a function with Strapi v4 #4956

SujayPrabhu96 opened this issue Apr 18, 2022 · 17 comments

Comments

@SujayPrabhu96
Copy link

SujayPrabhu96 commented Apr 18, 2022

Environment

self-hosted (https://develop.sentry.dev/self-hosted/)

Version

  • Strapi - 4.1.7
  • @sentry/node - 6.19.6
  • @sentry/tracing - 6.19.6

No response

Steps to Reproduce

Instrument Strapi v4 application with Sentry integration. Followed Performance monitoring setup with Koa from the doc

Expected Result

Log Strapi erros on Sentry

Actual Result

Not able to track errors on Sentry instead logs self._mergeOptions is not a function

Screenshot 2022-04-18 at 8 48 29 PM

@getsentry-release
Copy link

Routing to @getsentry/open-source for triage. ⏲️

@chadwhitacre
Copy link
Member

Hrm, routing this to Web FE since it seems to be a support request with using Koa vs. a self-hosted setup question.

@getsentry-release
Copy link

Routing to @getsentry/team-web-sdk-frontend for triage. ⏲️

@lforst lforst transferred this issue from getsentry/sentry Apr 20, 2022
@lforst
Copy link
Contributor

lforst commented Apr 20, 2022

Hi @SujayPrabhu96, thanks for writing in! To effectively investigate your issue we would need a little bit more information. Can you share which versions of Koa, Strapi, and the sentry SDK you are using and how exactly you set up the Sentry SDK (ie, how you configured the Sentry.init() call)?

@SujayPrabhu96
Copy link
Author

Hi @SujayPrabhu96, thanks for writing in! To effectively investigate your issue we would need a little bit more information. Can you share which versions of Koa, Strapi, and the sentry SDK you are using and how exactly you set up the Sentry SDK (ie, how you configured the Sentry.init() call)?

Hi @lforst,
I have updated the versions in the issue. As Strapi is built on top of Koa, it is not installed separately.
Regarding setup I have created custom middleware sentry in Strapi to make Sentry.init() call.

For reference here is my PR: SujayPrabhu96/integrate-sentry-with-strapi#1
Configured Sentry using sentry middleware

@lforst
Copy link
Contributor

lforst commented Apr 20, 2022

I'm seeing in the repository you linked that you have old Sentry dependencies in your lockfile: example

The particular version you have, has a bug that was reported in #2622 and got fixed in #3458.

Can you try and update those dependencies to at least version 6.3.2 and report back whether that fixed the issue? By the way, I strongly recommend using the same versions across all Sentry SDK dependencies, as having different versions might introduce unknown behaviour.

@SujayPrabhu96
Copy link
Author

Looks like Strapi v4 by default adds these dependencies to yarn.lock

yarn why @sentry/core

=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "@strapi#strapi#@strapi#generate-new#@sentry#node" depends on it
   - Hoisted from "@strapi#strapi#@strapi#generate-new#@sentry#node#@sentry#core"

@github-actions
Copy link
Contributor

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 label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@SujayPrabhu96
Copy link
Author

Strapi version 4.11.1 upgraded to latest Sentry version. This fixed the issue. So, closing this

@VictorienTardif
Copy link

Strapi version 4.11.1 upgraded to latest Sentry version. This fixed the issue. So, closing this

I'm still having the issue with Strapi 4.2.3 and Sentry 6.19.6 for all Sentry packages :/

Are you sure it is fixed?
Is it a regression @lforst?

Thx

@AbhiPrasad
Copy link
Member

@VictorienTardif could you run yarn why @sentry/core and yarn why @sentry/hub and reply with the output (npm ls will work like yarn why if you're using that)

@VictorienTardif
Copy link

Hello @AbhiPrasad, here it is:

yarn why @sentry/core
yarn why v1.22.17
[1/4] 🤔  Why do we have the module "@sentry/core"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "_project_#@strapi#plugin-sentry#@sentry#node" depends on it
   - Hoisted from "_project_#@strapi#plugin-sentry#@sentry#node#@sentry#core"
info Disk size without dependencies: "932KB"
info Disk size with unique dependencies: "5.09MB"
info Disk size with transitive dependencies: "5.09MB"
info Number of shared dependencies: 5
✨  Done in 0.51s.
yarn why @sentry/hub
yarn why v1.22.17
[1/4] 🤔  Why do we have the module "@sentry/hub"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@sentry/[email protected]"
info Reasons this module exists
   - "_project_#@strapi#plugin-sentry#@sentry#node" depends on it
   - Hoisted from "_project_#@strapi#plugin-sentry#@sentry#node#@sentry#hub"
   - Hoisted from "_project_#@strapi#plugin-sentry#@sentry#node#@sentry#core#@sentry#hub"
   - Hoisted from "_project_#@strapi#plugin-sentry#@sentry#node#@sentry#core#@sentry#minimal#@sentry#hub"
info Disk size without dependencies: "564KB"
info Disk size with unique dependencies: "3.99MB"
info Disk size with transitive dependencies: "3.99MB"
info Number of shared dependencies: 3
✨  Done in 0.32s.

@AbhiPrasad
Copy link
Member

@VictorienTardif, could you try upgrading to v7? This may fix the error as per:

const options = _mergeOptions(self._options, clientOptions);

@VictorienTardif
Copy link

Hi, I found out that it was a problem with Strapi docker image that installs Strapi globally.
There must be a mismatch with Sentry versions or something.
Installing everything locally and running outside of docker it's working fine.

Thx for your help.

@vladanpaunovic
Copy link
Contributor

@VictorienTardif, if this is not the case already, I would encourage you to use the official Strapi integration for Sentry. They are not always on the newest version of Sentry, but they do make sure that Sentry works properly.

@VictorienTardif
Copy link

Yes that's what I was using already.

@lforst
Copy link
Contributor

lforst commented Aug 1, 2022

@VictorienTardif I don't know if your issue is already resolved. The Strapi folks fixed this in their 4.11.1 version - please update to at least that version (as you're still on 4.2.3). Additionally, make sure that all your sentry deps are on the same version. (check in lockfile)

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

8 participants