gatsby-plugin-mailchimp: _GATSBY_PLUGIN_MAILCHIMP_ADDRESS__ is not defined
System details
- node v8.9.3
- npm 6.5.0
- gatsby: “^2.13.23”
- gatsby-plugin-mailchimp: “^5.1.2”,
Usage
The endpoint is defined in gatsby-config.js
as:
{
resolve: 'gatsby-plugin-mailchimp',
options: {
endpoint: `https://gmail.us3.list-manage.com/subscribe/post?u=X&id=Y`,
}
}
And called:
const IndexPage = props => {
const [email, setEmail] = useState('')
const handleSubmit = async (e) => {
e.preventDefault();
const result = await addToMailChimp(email)
}
const handleChange = e => {
setEmail(e.target.value)
}
return (
...
<form onSubmit={handleSubmit}>
<input type='text' value={email} onChange={handleChange}/>
<input type="submit" value="Request access"/>
</form>
}
Stacktrace
node_modules/gatsby-plugin-mailchimp/index.js:88
_callee$
src/pages/index.js:15
12 | const IndexPage = (props) => {
13 | const [email, setEmail] = useState('')
14 |
> 15 | const handleSubmit = async (e) => {
16 | e.preventDefault();
17 | const result = await addToMailChimp(email)
18 | }
View compiled
▼ 7 stack frames were expanded.
tryCatch
node_modules/regenerator-runtime/runtime.js:45
Generator.invoke [as _invoke]
node_modules/regenerator-runtime/runtime.js:271
Generator.prototype.<computed> [as next]
node_modules/regenerator-runtime/runtime.js:97
asyncGeneratorStep
node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:3
_next
node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:25
(anonymous function)
node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:32
(anonymous function)
node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js:21
▲ 7 stack frames were expanded.
handleSubmit
src/pages/index.js:15
12 | const IndexPage = (props) => {
13 | const [email, setEmail] = useState('')
14 |
> 15 | const handleSubmit = async (e) => {
16 | e.preventDefault();
17 | const result = await addToMailChimp(email)
18 | }
View compiled
▼ 20 stack frames were expanded.
HTMLUnknownElement.callCallback
node_modules/react-dom/cjs/react-dom.development.js:150
invokeGuardedCallbackDev
node_modules/react-dom/cjs/react-dom.development.js:200
invokeGuardedCallback
node_modules/react-dom/cjs/react-dom.development.js:257
invokeGuardedCallbackAndCatchFirstError
node_modules/react-dom/cjs/react-dom.development.js:271
executeDispatch
node_modules/react-dom/cjs/react-dom.development.js:562
executeDispatchesInOrder
node_modules/react-dom/cjs/react-dom.development.js:584
executeDispatchesAndRelease
node_modules/react-dom/cjs/react-dom.development.js:681
executeDispatchesAndReleaseTopLevel
node_modules/react-dom/cjs/react-dom.development.js:689
forEachAccumulated
node_modules/react-dom/cjs/react-dom.development.js:663
runEventsInBatch
node_modules/react-dom/cjs/react-dom.development.js:817
runExtractedEventsInBatch
node_modules/react-dom/cjs/react-dom.development.js:825
handleTopLevel
node_modules/react-dom/cjs/react-dom.development.js:4827
batchedUpdates$1
node_modules/react-dom/cjs/react-dom.development.js:20440
batchedUpdates
node_modules/react-dom/cjs/react-dom.development.js:2152
dispatchEvent
node_modules/react-dom/cjs/react-dom.development.js:4906
(anonymous function)
node_modules/react-dom/cjs/react-dom.development.js:20491
unstable_runWithPriority
node_modules/scheduler/cjs/scheduler.development.js:255
interactiveUpdates$1
node_modules/react-dom/cjs/react-dom.development.js:20490
interactiveUpdates
node_modules/react-dom/cjs/react-dom.development.js:2171
dispatchInteractiveEvent
node_modules/react-dom/cjs/react-dom.development.js:4883
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 2
- Comments: 15 (3 by maintainers)
I had the same problem but I only had to restart the gatsby server and it worked again
The same issue observed in my case, which gets resolved after restarting node (npm start). I was able to add a couple of emails within the last couple of days and then I’ve run it today and had the same issue:
which points to this piece of code: