{"id":1219,"date":"2022-11-19T22:04:09","date_gmt":"2022-11-19T22:04:09","guid":{"rendered":"https:\/\/editjournal.redakt.eu\/faxmodem\/?p=1219"},"modified":"2022-11-19T22:04:09","modified_gmt":"2022-11-19T22:04:09","slug":"environment-variable-undefined-in-gatsbyjs","status":"publish","type":"post","link":"https:\/\/editjournal.redakt.eu\/faxmodem\/blog\/development\/cloud-serverless\/environment-variable-undefined-in-gatsbyjs\/","title":{"rendered":"Environment variable undefined in GatsbyJS?"},"content":{"rendered":"<p>If you're trying to use an environment variable in your GatsbyJS HTML code and it keeps being <code>undefined<\/code> once you build, this could be because most environment variables are prevented from being rendered e.g. so that your private API key is not revealed by accident.<\/p>\n<p>If your variable does have to end up in the HTML, make sure to prefix it's name with <code>GATSBY_<\/code><\/p>\n<p>For example,<\/p>\n<ul>\n<li>define as <code>GATSBY_BING_MARKET=&quot;en-GB&quot;<\/code><\/li>\n<li>use as <code>data-src={&quot;https:\/\/ui.customsearch.ai\/api\/ux\/rendering-js?market=&quot;+process.env.GATSBY_BING_MARKET}<\/code><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re trying to use an environment variable in your GatsbyJS HTML code and it keeps being undefined once you build, this could be because most environment variables are prevented from being rendered e.g. so that your private API key is not revealed by accident. If your variable does have to end up in the&hellip; <a class=\"more-link\" href=\"https:\/\/editjournal.redakt.eu\/faxmodem\/blog\/development\/cloud-serverless\/environment-variable-undefined-in-gatsbyjs\/\">Continue reading <span class=\"screen-reader-text\">Environment variable undefined in GatsbyJS?<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[778],"tags":[683],"class_list":["post-1219","post","type-post","status-publish","format-standard","hentry","category-cloud-serverless","tag-gatsbyjs","entry"],"_links":{"self":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/comments?post=1219"}],"version-history":[{"count":1,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1219\/revisions"}],"predecessor-version":[{"id":1221,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/posts\/1219\/revisions\/1221"}],"wp:attachment":[{"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/media?parent=1219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/categories?post=1219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/editjournal.redakt.eu\/faxmodem\/wp-json\/wp\/v2\/tags?post=1219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}