gatsby-plugin-algolia: ERROR #11321 PLUGIN --> AlgoliaSearchError: Please provide an application ID.
Hiya! One moment, everything was working just fine. And the next, I started receiving an error. When I run gatsby build
, I now receive:
frontend.v1|Algolia ⇒ gatsby build
success open and validate gatsby-configs - 0.042 s
success load plugins - 1.139 s
success onPreInit - 0.017 s
success delete html and css files from previous builds - 0.029 s
info One or more of your plugins have changed since the last time you ran Gatsby.
As
a precaution, we're deleting your site's cache to ensure there's not any stale
success initialize cache - 0.046 s
success copy gatsby files - 0.066 s
success onPreBootstrap - 0.022 s
success source and transform nodes - 0.182 s
success Add explicit types - 0.019 s
success Add inferred types - 0.214 s
success Processing types - 0.102 s
success building schema - 0.433 s
success createPages - 0.048 s
success createPagesStatefully - 0.061 s
success onPreExtractQueries - 0.013 s
success update schema - 0.043 s
success extract queries from components - 0.398 s
success write out requires - 0.015 s
success write out redirect data - 0.013 s
success Build manifest and related icons - 0.177 s
success onPostBootstrap - 0.195 s
⠀
info bootstrap finished - 6.407 s
⠀
success run static queries - 0.047 s — 2/2 59.81 queries/second
success Building production JavaScript and CSS bundles - 9.594 s
success Rewriting compilation hashes - 0.027 s
warn code block or inline code language not specified in markdown. applying generic
code block
success run page queries - 0.645 s — 10/10 16.18 queries/second
success Building static HTML for pages - 1.744 s — 10/10 33.95 pages/second
info Generated public/sw.js, which will precache 7 files, totaling 351300 bytes.
The following pages will be precached:
/offline-plugin-app-shell-fallback/index.html
⠁
ERROR #11321 PLUGIN
"gatsby-plugin-algolia" threw an error while running the onPostBuild lifecycle:
Please provide an application ID. Usage: algoliasearch(applicationID, apiKey, opts)
AlgoliaSearchError: Please provide an application ID. Usage: algoliasearch(applic ationID, apiKey, opts)
- AlgoliaSearchCore.js:50 AlgoliaSearchNodeJS.AlgoliaSearchCore
[frontend.v1]/[algoliasearch]/src/AlgoliaSearchCore.js:50:11
- AlgoliaSearch.js:11 AlgoliaSearchNodeJS.AlgoliaSearch
[frontend.v1]/[algoliasearch]/src/AlgoliaSearch.js:11:21
- AlgoliaSearchServer.js:17 AlgoliaSearchNodeJS.AlgoliaSearchServer
[frontend.v1]/[algoliasearch]/src/server/builds/AlgoliaSearchServer.js:17:17
- node.js:83 new AlgoliaSearchNodeJS
[frontend.v1]/[algoliasearch]/src/server/builds/node.js:83:23
- node.js:68 algoliasearch
[frontend.v1]/[algoliasearch]/src/server/builds/node.js:68:10
- gatsby-node.js:18 Object.exports.onPostBuild
[frontend.v1]/[gatsby-plugin-algolia]/gatsby-node.js:18:18
- api-runner-node.js:234 runAPI
[frontend.v1]/[gatsby]/dist/utils/api-runner-node.js:234:37
- api-runner-node.js:347 Promise.catch.decorateEvent.pluginName
[frontend.v1]/[gatsby]/dist/utils/api-runner-node.js:347:15
- debuggability.js:427 Promise._execute
[frontend.v1]/[bluebird]/js/release/debuggability.js:427:9
- promise.js:518 Promise._resolveFromExecutor
[frontend.v1]/[bluebird]/js/release/promise.js:518:18
- promise.js:103 new Promise
[frontend.v1]/[bluebird]/js/release/promise.js:103:10
- api-runner-node.js:346
[frontend.v1]/[gatsby]/dist/utils/api-runner-node.js:346:12
- util.js:16 tryCatcher
[frontend.v1]/[bluebird]/js/release/util.js:16:23
- reduce.js:166 Object.gotValue
[frontend.v1]/[bluebird]/js/release/reduce.js:166:18
- reduce.js:155 Object.gotAccum
[frontend.v1]/[bluebird]/js/release/reduce.js:155:25
- util.js:16 Object.tryCatcher
[frontend.v1]/[bluebird]/js/release/util.js:16:23
Here is my repo! I imagine my .env file will not be visible, but it does exist with my Angolia credentials accurately stored. Any debugging types are gladly welcomed! Thanks in advance.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 26 (9 by maintainers)
Thanks @Isaac-Tait! We figured it out. Turns out that Netlify triggers another build on another account hence it fails on those builds because no env variables were set up in Netlify
I figured it out! Two things were at play:
My Algolia trail expired. I needed to switch to a community plan, or a paid plan. My account was in limbo. (hence
gatsby develop
no longer working.)When I run
gatsby develop
my.env
file is used. When I rungatsby build
the app searches for a.env.production
file, and I did not have one. Creating the.env.production
and putting my credentials in that file did the trick.Thanks for your help @Haroenv .
the values of the environment is kept secret (which is good, don’t post that publicly), but I assume the value isn’t right
@Isaac-Tait in netlify we have both the GATSBY_ prefix and the standard Algolia VARS set up and it is working fine. I think but I may be wrong you need the GATSBY_ ones so Gatsby can build it and the standard Algolia ones so it works when it’s built. You would also need both in your .env file as well.
All sorted cheers. Although as a note should anyone else stumble upon this issue. Once the variables were added I still had errors with undefined. This was resolved by create Gatsby_ pre-fixed env vars which were needed for Gatsby Cloud to find them.
Hey @Haroenv, Thanks for getting back to me so quickly. Yes it does consistently fail. BUT I plugged the credentials directly into the gatsby-config file (instead of calling it from my .env file) and it worked!
Thanks for your patience - I am fairly new to all of this.