From 2655ca65e1f19240fd6475b719aeaa90c594f316 Mon Sep 17 00:00:00 2001 From: GwonHeeJun Date: Mon, 11 Jan 2021 01:56:39 +0900 Subject: [PATCH] Fix errors that fail to load environment variables --- next.config.js | 15 +++++++++++++-- utils/firebase.ts | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/next.config.js b/next.config.js index 5113d67f..898eb623 100644 --- a/next.config.js +++ b/next.config.js @@ -1,2 +1,13 @@ -const withImages = require('next-images') -module.exports = withImages() +const withImages = require('next-images'); +module.exports = withImages({ + env: { + FIREBASE_API_KEY: process.env.FIREBASE_API_KEY, + FIREBASE_AUTH_DOMAIN: process.env.FIREBASE_AUTH_DOMAIN, + FIREBASE_DATABASE_URL: process.env.FIREBASE_DATABASE_URL, + FIREBASE_PROJECT_ID: process.env.FIREBASE_PROJECT_ID, + FIREBASE_STORAGE_BUKET: process.env.FIREBASE_STORAGE_BUKET, + FIREBASE_MESSAGING_SENDER_ID: process.env.FIREBASE_MESSAGING_SENDER_ID, + FIREBASE_APP_ID: process.env.FIREBASE_APP_ID, + FIREBASE_MEASUREMENT_ID: process.env.FIREBASE_MEASUREMENT_ID + }, +}); diff --git a/utils/firebase.ts b/utils/firebase.ts index e8c49e31..c1978a90 100644 --- a/utils/firebase.ts +++ b/utils/firebase.ts @@ -1,6 +1,7 @@ import firebase from 'firebase/app'; import 'firebase/analytics'; + const config = { apiKey: process.env.FIREBASE_API_KEY, authDomain: process.env.FIREBASE_AUTH_DOMAIN, @@ -8,7 +9,7 @@ const config = { projectId: process.env.FIREBASE_PROJECT_ID, storageBuket: process.env.FIREBASE_STORAGE_BUKET, messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID, - apId: process.env.FIREBASE_APP_ID, + appId: process.env.FIREBASE_APP_ID, measurementId: process.env.FIREBASE_MEASUREMENT_ID, };