Title: require('@grpc/grpc-js') returns undefined when using sentry configs on next-js app · Issue #6970 · getsentry/sentry-javascript · GitHub
Open Graph Title: require('@grpc/grpc-js') returns undefined when using sentry configs on next-js app · Issue #6970 · getsentry/sentry-javascript
X Title: require('@grpc/grpc-js') returns undefined when using sentry configs on next-js app · Issue #6970 · getsentry/sentry-javascript
Description: 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/...
Open Graph Description: 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 th...
X Description: 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 th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/6970
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"require('@grpc/grpc-js') returns undefined when using sentry configs on next-js app","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which package are you using?\n\n@sentry/nextjs\n\n### SDK Version\n\n7.34.0\n\n### Framework Version\n\nNext 12.0.4\n\n### Link to Sentry event\n\n_No response_\n\n### SDK Setup\n\n```\r\n// This file sets a custom webpack configuration to use your Next.js app\r\n// with Sentry.\r\n// https://nextjs.org/docs/api-reference/next.config.js/introduction\r\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\r\nconst { withSentryConfig } = require('@sentry/nextjs');\r\n\r\n/** @type {import('next').NextConfig} */\r\nconst nextConfig = {\r\n\twebpackDevMiddleware: (config) => {\r\n\t\tconfig.watchOptions = {\r\n\t\t\tpoll: 1000,\r\n\t\t\taggregateTimeout: 300,\r\n\t\t};\r\n\t\treturn config;\r\n\t},\r\n\treactStrictMode: true,\r\n\tenv: {\r\n\t\tREACT_APP_DISABLE_WARNINGS: 1,\r\n\t},\r\n\tfuture: {\r\n\t\twebpack5: true, // by default, if you customize webpack config, they switch back to version 4.\r\n\t\t// Looks like backward compatibility approach.\r\n\t},\r\n\twebpack(config) {\r\n\t\tconfig.resolve.fallback = {\r\n\t\t\t...config.resolve.fallback, // if you miss it, all the other options in fallback, specified\r\n\t\t\t// by next.js will be dropped. Doesn't make much sense, but how it is\r\n\t\t\tfs: false, // the solution\r\n\t\t};\r\n\r\n\t\treturn config;\r\n\t},\r\n};\r\n\r\nconst sentryWebpackPluginOptions = {\r\n\t// Additional config options for the Sentry Webpack plugin. Keep in mind that\r\n\t// the following options are set automatically, and overriding them is not\r\n\t// recommended:\r\n\t// release, url, org, project, authToken, configFile, stripPrefix,\r\n\t// urlPrefix, include, ignore\r\n\r\n\tsilent: true, // Suppresses all logs\r\n\thideSourcemaps: true,\r\n\t// For all available options, see:\r\n\t// https://github.com/getsentry/sentry-webpack-plugin#options.\r\n};\r\n\r\nmodule.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions);\r\n```\r\n\n\n### Steps to Reproduce\n\nI'm trying to import @grpc/grpc-js inside an API call. When I changed the next.config.js as I shared, require('@grpc/grpc-js') returns undefined.\n\n### Expected Result\n\nImporting grpc package without problem\n\n### Actual Result\n\n`\r\nTypeError: Cannot read properties of undefined (reading 'loadPackageDefinition')\r\n 4 | const grpc = require('@grpc/grpc-js');\r\n 5 | const pkgDefs = importProto('proto/goquake.proto');\r\n> 6 | const goQuakeProto = grpc.loadPackageDefinition(pkgDefs).GoQuake;\r\n`","author":{"url":"https://github.com/geoport","@type":"Person","name":"geoport"},"datePublished":"2023-01-30T08:50:54Z","url":"https://github.com/getsentry/sentry-javascript/issues/6970"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:13df9f38-bb58-8726-98b2-d5d7a1bc5cc4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D76:279C41:760622:A6DE8C:6B0480CF |
| html-safe-nonce | 0ffed8e7ab05e6b2fa3cbd3841c533de6a0f4557cc842d2abef7c9999bf79584 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDc2OjI3OUM0MTo3NjA2MjI6QTZERThDOjZCMDQ4MENGIiwidmlzaXRvcl9pZCI6IjcwNjY5MTEzOTc5MDA0ODQ4MTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e416c84af7e7a933a7bc9676ff31e54dcedbde3fc95049959baeb0b227d1f3f7 |
| hovercard-subject-tag | issue:1561995599 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/6970/issue_layout |
| twitter:image | https://opengraph.githubassets.com/19a4dec7be10942c83995f2426de44500ce5bb58034534aa95749a23883cc926/getsentry/sentry-javascript/issues/6970 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/19a4dec7be10942c83995f2426de44500ce5bb58034534aa95749a23883cc926/getsentry/sentry-javascript/issues/6970 |
| og:image:alt | 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 th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | geoport |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0366ddfb372682a32e92a5d86155cb08fa83e5bbe79953a968789f2f7e24c511 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ed3f2e01f6b7672780c586c8af0e72726374d7b6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width