gatsby-plugin-sentry
gatsby-plugin-sentry copied to clipboard
Gatsby build produces error with webpack
I'm getting an error when running yarn develop.
ERROR Failed to compile with 1 errors 22:46:08
error in ./src/components/ErrorBoundary/ErrorBoundary.jsx
Module Error (from ./node_modules/eslint-loader/index.js):
/Users/test/workspace/private/graphcms-calculator/src/components/ErrorBoundary/ErrorBoundary.jsx
11:5 error 'Sentry' is not defined no-undef
16:5 error 'Sentry' is not defined no-undef
26:13 warning The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md jsx-a11y/anchor-is-valid
26:31 error 'Sentry' is not defined
gatsby-browser.js
import * as Sentry from "@sentry/browser";
const onClientEntry = function(_, pluginParams) {
Sentry.init(pluginParams);
window.Sentry = Sentry;
};
export { onClientEntry };
gatsby-config.js
const env = process.env.NODE_ENV ? process.env.NODE_ENV : "production";
require("dotenv").config({
path: `.env.${env}`
});
console.log("Running as env: ", env);
console.log(
`Fetching Data from : ${process.env.GRAPHCMS_CALCULATOR_GRAPHQL_ENDPOINT}`
);
module.exports = {
pathPrefix: "/",
siteMetadata: {
siteUrl: process.env.GRAPHCMS_CALCULATOR_SITE_URL
},
plugins: [
{
resolve: "gatsby-source-graphql",
options: {
// This type will contain remote schema Query type
typeName: "GCMS",
// This is field under which it's accessible
fieldName: "gcms",
// Url to query from
url: process.env.GRAPHCMS_CALCULATOR_GRAPHQL_ENDPOINT,
headers: {
Authorization: `Bearer ${
process.env.GRAPHCMS_CALCULATOR_GRAPHQL_TOKEN
}`
}
}
},
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`
}
},
{
resolve: "gatsby-plugin-typography",
options: {
pathToConfigModule: "config/typography.js",
omitGoogleFont: true
}
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png` // This path is relative to the root of the site.
}
},
"gatsby-plugin-sitemap",
"gatsby-plugin-offline",
{
resolve: "gatsby-plugin-sentry",
options: {
dsn: process.env.GRAPHCMS_CALCULATOR_SENTRY_DSN,
environment: env,
enabled: (() => ["production", "staging"].indexOf(env) !== -1)()
}
}
]
};
gatsby-node.js
const path = require("path");
const calculatorGen = require("./src/generators/Calculators/Calculators");
exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions;
return new Promise((resolve, reject) => {
calculatorGen
.createAllCalculators(graphql, createPage)
.then(() => {
console.log("Calculators created");
resolve();
})
.catch(error => {
throw new Error(error);
});
});
// pagesGen.createAllPages(graphql, createPage)
// postGen.createAllPosts(graphql, createPage)
};
/* Allows named imports */
exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
modules: [path.resolve(__dirname, "src"), "node_modules"]
}
});
};
I'm getting the following error when running yarn build
:
error Building static HTML failed for path "/de/dog-years-calculation"
See our docs page on debugging HTML builds for help https://gatsby.app/debug-html
8 | else
9 | root["lib"] = factory(root["@reach/router"], root["core-js/modules/es6.array.find"], root["core-js/modules/es6.array.iterator"], root["core-js/modules/es6.array.sort"], root["core-js/modules/es6.function.name"], root["core-js/modules/es6.map"], root["core-js/modules/es6.object.assign"], root["core-js/modules/es6.object.keys"], root["core-js/modules/es6.regexp.constructor"], root["core-js/modules/es6.regexp.match"], root["core-js/modules/es6.regexp.replace"], root["core-js/modules/es6.regexp.split"], root["core-js/modules/es6.regexp.to-string"], root["core-js/modules/es6.string.ends-with"], root["core-js/modules/es6.string.iterator"], root["core-js/modules/web.dom.iterable"], root["fs"], root["lodash"], root["minimatch"], root["path"], root["pify"], root["react"], root["react-dom/server"], root["react-helmet"]);
> 10 | })(this, function(__WEBPACK_EXTERNAL_MODULE__reach_router__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_find__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_iterator__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_sort__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_function_name__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_map__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_object_assign__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_object_keys__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_constructor__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_match__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_replace__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_split__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_regexp_to_string__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_ends_with__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_string_iterator__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_web_dom_iterable__, __WEBPACK_EXTERNAL_MODULE_fs__, __WEBPACK_EXTERNAL_MODULE_lodash__, __WEBPACK_EXTERNAL_MODULE_minimatch__, __WEBPACK_EXTERNAL_MODULE_path__, __WEBPACK_EXTERNAL_MODULE_pify__, __WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_react_dom_server__, __WEBPACK_EXTERNAL_MODULE_react_helmet__) {
| ^
11 | return
WebpackError: Invariant Violation: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev en vironment for full errors and additional helpful warnings.
- universalModuleDefinition:10 ba
lib/webpack/universalModuleDefinition:10:2
- bootstrap:33 a.render
lib/webpack/bootstrap:33:1
- bootstrap:29 a.read
lib/webpack/bootstrap:29:1
- static-entry.js:194 Module../.cache/static-entry.js.__webpack_exports__.default
lib/.cache/static-entry.js:194:18
- bootstrap:24 Promise
lib/webpack/bootstrap:24:1
- cache.esm.js:217 Promise._execute
[bleichi-calculators]/[@emotion]/cache/dist/cache.esm.js:217:1
- bootstrap:68 new Promise
lib/webpack/bootstrap:68:1
- bootstrap:5 tryCatcher
lib/webpack/bootstrap:5:1
- bootstrap:50 MappingPromiseArray._promiseFulfilled
lib/webpack/bootstrap:50:1
- bootstrap:67 MappingPromiseArray.init
lib/webpack/bootstrap:67:1
- bootstrap:19 MappingPromiseArray._asyncInit
lib/webpack/bootstrap:19:1