algolia / gatsby-plugin-algolia

A plugin to push to Algolia based on graphQl queries
https://yarn.pm/gatsby-plugin-algolia
Apache License 2.0
177 stars 45 forks source link

ENV Variables not recognised when deploying #43

Closed Whatapalaver closed 4 years ago

Whatapalaver commented 4 years ago

I am having problems trying to deploy a Gatsby site with Algolia search functionality included. I have a .env file with my ENV_VARIABLES set up and I have transferred these to the deploy settings section of the netlify ui.

These build and run locally, however I am getting netlify build failures when I deploy, that say:

12:10:12 PM:   AlgoliaSearchError: Please provide an application ID. Usage: algoliasearch(app  licationID, apiKey, opts)
12:10:12 PM:   
12:10:12 PM:   - AlgoliaSearchCore.js:51 AlgoliaSearchNodeJS.AlgoliaSearchCore
12:10:12 PM:     [repo]/[gatsby-plugin-algolia]/[algoliasearch]/src/AlgoliaSearchCore.js:51:1    1
12:10:12 PM:   
12:10:12 PM:   - AlgoliaSearch.js:11 AlgoliaSearchNodeJS.AlgoliaSearch
12:10:12 PM:     [repo]/[gatsby-plugin-algolia]/[algoliasearch]/src/AlgoliaSearch.js:11:21

I have the following in my .env file:

GATSBY_ALGOLIA_APP_ID=057XXXXXXX
GATSBY_ALGOLIA_SEARCH_ONLY_API_KEY=b79XXXXXXXXX
ALGOLIA_ADMIN_API_KEY=fdc75d20eb2dXXXXXXXXX
GATSBY_ALGOLIA_INDEX_NAME=XXXXXX

I have transferred all these (except the admin key) to the build section of netlify but I still get the error. I've tried with and without the GATSBY_ prefix as well but still no luck.

Any ideas or recommendations for how to set this up to deploy? Thanks

Whatapalaver commented 4 years ago

Oh scrub the question - I've finally got it to work! I'm not convinced I know what has changed but I basically have all 4 of the above ENV_VARS in the netlify build settings and it deployed.

Haroenv commented 4 years ago

Is it possible you forgot to install dotenv before?