Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt.js Internal Server Error with firebase #41

Closed
dowdiness opened this issue May 8, 2019 · 16 comments
Closed

Nuxt.js Internal Server Error with firebase #41

dowdiness opened this issue May 8, 2019 · 16 comments
Labels
question Further information is requested

Comments

@dowdiness
Copy link

dowdiness commented May 8, 2019

Hello

Everything is fine when I work in locally but in production I get Nuxt.js Internal Server Error.

I found some threads about this issue with Next.js and it seems if you only import submodules of firebase in Next.js, it works fine.

Firebase + Next.JS

How to get a next.js / firestore project to deploy on Zeit 2.0?

Actually, I only import submodules but still doesn't work properly.

This is my commit added firebase into project

This project uses nuxt v2.6.3 and firebase v6.0.1.

Anyone has an idea to solve this issue?

@pi0
Copy link
Member

pi0 commented May 8, 2019

@dowdiness Please consider not exposing apiKey in a public repository.

Can you please share the link of your deployment? Logs are accessible with /_logs

@pi0 pi0 added the question Further information is requested label May 8, 2019
@MarvinMiles
Copy link

MarvinMiles commented May 9, 2019

As I figured out, this error caused by importing submodule in second line:

import { firebase } from '@firebase/app'
import '@firebase/firestore'

Temporary way to solve this might be importing firebase-admin for SSR and submodules for Client Side. But I haven't tested it yet.

@ZackPashkin
Copy link

Having the same issue

@MarvinMiles
Copy link

MarvinMiles commented May 22, 2019

I have fixed it by adding firebase packages into webpack externals as CommonJS modules in nuxt.config file for SSR bundle:

 build: {
    extend ( config, { isDev, isClient, isServer } ) {
      if ( isServer ) {
        config.externals = {
          '@firebase/app': 'commonjs @firebase/app',
          '@firebase/firestore': 'commonjs @firebase/firestore',
          //etc...
        }
      }
    }
}

So glad I finally managed it out. Hope it will help anyone else

@Atinux Atinux closed this as completed Jun 14, 2019
@codeofsumit
Copy link

codeofsumit commented Jun 24, 2019

Same issue here.

@MarvinMiles can you elaborate on your solution? It doesn't work for me but if I'm able to understand it, I might be able to come up with something myself. What exactly is the issue here? Is it Firebase? Or Nuxt? (or even ZEIT?) What causes that Problem?

Thank you for any hints!

@codeofsumit
Copy link

codeofsumit commented Jun 24, 2019

@Atinux I think this issue should be reopened. Using firebase breaks nuxt on ZEIT v2 and it doesn't seem there is an easy fix 🤔.
I've switched to spa-mode for now until I find a solution. Can anyone tell me what the problem actually is?

This is the output from ZEIT when a request is made:

START RequestId: a18d2768-e654-4db7-960a-2d158e8fe660 Version: $LATEST
END RequestId: a18d2768-e654-4db7-960a-2d158e8fe660
REPORT RequestId: a18d2768-e654-4db7-960a-2d158e8fe660	
Duration: 9.00 ms  Billed Duration: 100 ms   Memory Size: 3008 MB  Max Memory Used: 138 MB	
START RequestId: 6b173cbb-2cf3-44a6-9b73-c52707ea1c76 Version: $LATEST
END RequestId: 6b173cbb-2cf3-44a6-9b73-c52707ea1c76
REPORT RequestId: 6b173cbb-2cf3-44a6-9b73-c52707ea1c76	
Duration: 3.39 ms  Billed Duration: 100 ms   Memory Size: 3008 MB  Max Memory Used: 138 MB	

Error:
image

Failing Deployment example (private):
https://www-ipr8pahmo.now.sh/

@vimota
Copy link

vimota commented Sep 30, 2019

Was there a resolution to this issue?

@danielroe
Copy link
Member

danielroe commented Sep 30, 2019

@vimota #41 (comment) resolves your issue.

@codeofsumit
Copy link

@danielroe that doesn't fix the issue for me at least.

@danielroe
Copy link
Member

@codeofsumit It fixes your repro for me. https://ssr-zeit-firebase-h8vei5q9y.now.sh/

@codeofsumit
Copy link

Hm, will check again thank you!

@vimota
Copy link

vimota commented Sep 30, 2019

It did indeed resolve my issues as well! Just curious, is that a bug or expected behaviour? I don't totally get why we have to add it to the externals config.

@danielroe
Copy link
Member

I think this might be a reasonable explanation. for why firebase and lambda can cause problems.

@lincolnlemos
Copy link

lincolnlemos commented Jun 23, 2020

Hey guys,

Are you guys using the now.json version 2?
I got this message from the vercel build log:

Warning: Due to builds existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings

So, it looks like the @MarvinMiles didn't apply.

Anyway, I'm still getting the error here.

14:00:58.006  Cloning gitlab.com/linciapp/linci-public (Branch: master, Commit: 15c7069)
14:00:59.104  Cloning completed in 1098ms
14:00:59.104  Analyzing source code...
14:00:59.105  Warning: Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
14:01:00.116  Installing build runtime...
14:01:02.673  Build runtime installed: 2556.706ms
14:01:03.565   ----------------- Prepare build ----------------- 
14:01:03.565  Downloading files...
14:01:03.647  Working directory: /vercel/30aec542
14:01:03.649  Using npm
14:01:03.650  ℹ Prepare build took: 84.318644 ms
14:01:03.650   ----------------- Install devDependencies ----------------- 
14:01:03.651  Running npm install
14:01:40.665  > node-sass@4.14.1 install /vercel/30aec542/node_modules/node-sass
14:01:40.665  > node scripts/install.js
14:01:40.957  Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
14:01:41.813  Download complete
14:01:41.817  Binary saved to /vercel/30aec542/node_modules_dev/node-sass/vendor/linux-x64-72/binding.node
14:01:41.852  Caching binary to /vercel/.npm/node-sass/4.14.1/linux-x64-72_binding.node
14:01:41.991  > core-js@3.6.5 postinstall /vercel/30aec542/node_modules/@firebase/polyfill/node_modules/core-js
14:01:41.991  > node -e "try{require('./postinstall')}catch(e){}"
14:01:42.053  �[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
14:01:42.054  �[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: �[0m
14:01:42.054  �[96m>�[94m https://opencollective.com/core-js �[0m
14:01:42.054  �[96m>�[94m https://www.patreon.com/zloirock �[0m
14:01:42.054  �[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
14:01:42.149  > core-js@2.6.11 postinstall /vercel/30aec542/node_modules/core-js
14:01:42.149  > node -e "try{require('./postinstall')}catch(e){}"
14:01:42.213  �[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
14:01:42.213  �[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: �[0m
14:01:42.213  �[96m>�[94m https://opencollective.com/core-js �[0m
14:01:42.213  �[96m>�[94m https://www.patreon.com/zloirock �[0m
14:01:42.213  �[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
14:01:42.242  > ejs@2.7.4 postinstall /vercel/30aec542/node_modules/ejs
14:01:42.242  > node ./postinstall.js
14:01:42.300  Thank you for installing �[35mEJS�[0m: built with the �[32mJake�[0m JavaScript build tool (�[32mhttps://jakejs.com/�[0m)
14:01:42.544  > core-js@3.6.5 postinstall /vercel/30aec542/node_modules/plyr/node_modules/core-js
14:01:42.545  > node -e "try{require('./postinstall')}catch(e){}"
14:01:42.609  �[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
14:01:42.609  �[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: �[0m
14:01:42.609  �[96m>�[94m https://opencollective.com/core-js �[0m
14:01:42.609  �[96m>�[94m https://www.patreon.com/zloirock �[0m
14:01:42.609  �[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
14:01:42.634  > protobufjs@6.9.0 postinstall /vercel/30aec542/node_modules/protobufjs
14:01:42.634  > node scripts/postinstall
14:01:43.076  > ant-design-vue@1.6.2 postinstall /vercel/30aec542/node_modules/ant-design-vue
14:01:43.076  > node scripts/postinstall || echo "ignore"
14:01:43.143  �[96mThank you for using ant-design-vue (�[94m https://github.com/vueComponent/ant-design-vue �[96m)!�[0m
14:01:43.144  �[96mThe project needs your help! Please consider supporting of ant-design-vue on Open Collective or Patreon: 🙏�[0m
14:01:43.144  �[96m>�[94m https://opencollective.com/ant-design-vue �[0m
14:01:43.144  �[96m>�[94m https://www.patreon.com/tangjinzhou �[0m
14:01:43.144  �[96m更多赞助方式(支付宝、微信、Paypal)请查看如下链接: 🙏�[0m
14:01:43.144  �[96m>�[94m https://www.antdv.com/docs/vue/sponsor-cn �[0m
14:01:43.144  �[96mAnt Design Vue 官方网站: �[0m
14:01:43.144  �[96m>�[94m https://www.antdv.com/ �[0m
14:01:43.152  > node-sass@4.14.1 postinstall /vercel/30aec542/node_modules/node-sass
14:01:43.152  > node scripts/build.js
14:01:43.304  Binary found at /vercel/30aec542/node_modules_dev/node-sass/vendor/linux-x64-72/binding.node
14:01:43.304  Testing binary
14:01:43.404  Binary is fine
14:01:43.409  > nuxt@2.13.0 postinstall /vercel/30aec542/node_modules/nuxt
14:01:43.409  > opencollective || exit 0
14:01:43.603                                                               
14:01:43.603                                       :-:                     
14:01:43.603                                     .==-+:                    
14:01:43.603                                    .==. :+- .-=-              
14:01:43.603                                   .==.   :==++-+=.            
14:01:43.603                                  :==.     -**: :+=.           
14:01:43.603                                 :+-      :*+++. .++.          
14:01:43.603                                :+-      -*= .++: .=+.         
14:01:43.603                               -+:      =*-   .+*: .=+:        
14:01:43.603                              -+:     .=*-     .=*-  =+:       
14:01:43.603                            .==:     .+*:        -*-  -+-      
14:01:43.603                           .=+:.....:+*-.........:=*=..=*-     
14:01:43.603                           .-=------=++============++====:     
14:01:43.603                                           
14:01:43.603                            Thanks for installing nuxtjs 
14:01:43.603                   Please consider donating to our open collective
14:01:43.603                          to help us maintain this package.
14:01:43.603                                           
14:01:43.603                             Number of contributors: 229
14:01:43.603                                Number of backers: 332
14:01:43.604                                Annual budget: $71,867
14:01:43.604                               Current balance: $23,135
14:01:43.604                                           
14:01:43.604                   Donate: https://opencollective.com/nuxtjs/donate
14:01:43.604                                           
14:01:45.235  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
14:01:45.235  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
14:01:45.235  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
14:01:45.235  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
14:01:45.241  added 1998 packages from 957 contributors and audited 2002 packages in 41.177s
14:01:46.539  118 packages are looking for funding
14:01:46.539    run `npm fund` for details
14:01:46.540  found 0 vulnerabilities
14:01:46.576  ℹ Install devDependencies took: 42925.207772 ms
14:01:46.576   ----------------- Nuxt build ----------------- 
14:01:46.601  Running nuxt build --standalone --no-lock --config-file "nuxt.config.js"
14:01:48.321  ℹ Production build
14:01:48.321  ℹ Bundling for server and client side
14:01:48.322  ℹ Target: server
14:01:48.333  ✔ Builder initialized
14:01:48.384  ✔ Nuxt files generated
14:01:49.896  ℹ Compiling Client
14:02:17.329  ✔ Client: Compiled successfully in 27.43s
14:02:17.334  ℹ Compiling Server
14:02:23.185  ✔ Server: Compiled successfully in 5.85s
14:02:23.186  Hash: �[1m90ac07cd3ad6b6862748�[39m�[22m
14:02:23.187  Version: webpack �[1m4.43.0�[39m�[22m
14:02:23.187  Time: �[1m27435�[39m�[22mms
14:02:23.187  Built at: 06/23/2020 �[1m5:02:17 PM�[39m�[22m
14:02:23.187                           �[1mAsset�[39m�[22m      �[1mSize�[39m�[22m  �[1mChunks�[39m�[22m  �[1m�[39m�[22m                       �[1m�[39m�[22m       �[1mChunk Names�[39m�[22m
14:02:23.187  �[1m�[32m../server/client.manifest.json�[39m�[22m  42.4 KiB        �[1m�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m                     
14:02:23.187                    �[1m�[33m5.4983c5e.js�[39m�[22m   �[1m�[33m283 KiB�[39m�[22m       �[1m5�[39m�[22m  �[1m�[32m[emitted] [immutable]�[39m�[22m  �[1m�[33m[big]�[39m�[22m  
14:02:23.187                        �[1m�[32mLICENSES�[39m�[22m  4.66 KiB        �[1m�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m                     
14:02:23.187                  �[1m�[33mapp.ec921b7.js�[39m�[22m   �[1m�[33m2.9 MiB�[39m�[22m       �[1m0�[39m�[22m  �[1m�[32m[emitted] [immutable]�[39m�[22m  �[1m�[33m[big]�[39m�[22m  app
14:02:23.187          �[1m�[32mpages/index.e3591d2.js�[39m�[22m  2.01 KiB       �[1m1�[39m�[22m  �[1m�[32m[emitted] [immutable]�[39m�[22m         pages/index
14:02:23.187     �[1m�[32mpages/livestream.af3d4e7.js�[39m�[22m   235 KiB       �[1m2�[39m�[22m  �[1m�[32m[emitted] [immutable]�[39m�[22m         pages/livestream
14:02:23.187          �[1m�[32mpages/login.2da25e5.js�[39m�[22m  4.48 KiB       �[1m3�[39m�[22m  �[1m�[32m[emitted] [immutable]�[39m�[22m         pages/login
14:02:23.187              �[1m�[32mruntime.c326a79.js�[39m�[22m  2.39 KiB       �[1m4�[39m�[22m  �[1m�[32m[emitted] [immutable]�[39m�[22m         runtime
14:02:23.187   + 2 hidden assets
14:02:23.187  Entrypoint �[1mapp�[39m�[22m �[1m�[33m[big]�[39m�[22m = �[1m�[32mruntime.c326a79.js�[39m�[22m �[1m�[32mapp.ec921b7.js�[39m�[22m
14:02:23.187  �[1m�[33mWARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
14:02:23.187  This can impact web performance.
14:02:23.187  Assets: 
14:02:23.187    app.ec921b7.js (2.9 MiB)
14:02:23.187    5.4983c5e.js (283 KiB)�[39m�[22m
14:02:23.187  �[1m�[33mWARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (1000 KiB). This can impact web performance.
14:02:23.187  Entrypoints:
14:02:23.187    app (2.9 MiB)
14:02:23.187        runtime.c326a79.js
14:02:23.187        app.ec921b7.js
14:02:23.188  �[39m�[22m
14:02:23.188  Hash: �[1m1f4bc8a097550a5414d8�[39m�[22m
14:02:23.188  Version: webpack �[1m4.43.0�[39m�[22m
14:02:23.188  Time: �[1m5851�[39m�[22mms
14:02:23.188  Built at: 06/23/2020 �[1m5:02:23 PM�[39m�[22m
14:02:23.188                 �[1mAsset�[39m�[22m       �[1mSize�[39m�[22m  �[1mChunks�[39m�[22m  �[1m�[39m�[22m           �[1m�[39m�[22m�[1mChunk Names�[39m�[22m
14:02:23.188                  �[1m�[32m4.js�[39m�[22m  236 bytes       �[1m4�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m  
14:02:23.188        �[1m�[32mpages/index.js�[39m�[22m   7.14 KiB       �[1m1�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m  pages/index
14:02:23.188   �[1m�[32mpages/livestream.js�[39m�[22m    704 KiB       �[1m2�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m  pages/livestream
14:02:23.188        �[1m�[32mpages/login.js�[39m�[22m   20.8 KiB       �[1m3�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m  pages/login
14:02:23.188             �[1m�[32mserver.js�[39m�[22m   5.27 MiB       �[1m0�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m  app
14:02:23.188  �[1m�[32mserver.manifest.json�[39m�[22m  439 bytes        �[1m�[39m�[22m  �[1m�[32m[emitted]�[39m�[22m  
14:02:23.188   + 5 hidden assets
14:02:23.188  Entrypoint �[1mapp�[39m�[22m = �[1m�[32mserver.js�[39m�[22m �[1m�[32mserver.js.map�[39m�[22m
14:02:23.188  �[1m�[33mWARNING in ./node_modules_dev/component-classes/index.js
14:02:23.188  Module not found: Error: Can't resolve 'indexof' in '/vercel/30aec542/node_modules_dev/component-classes'
14:02:23.188   @ ./node_modules_dev/component-classes/index.js
14:02:23.188   @ ./node_modules_dev/ant-design-vue/lib/_util/css-animation/index.js
14:02:23.188   @ ./node_modules_dev/ant-design-vue/lib/_util/getTransitionProps.js
14:02:23.188   @ ./node_modules_dev/ant-design-vue/lib/alert/index.js
14:02:23.188   @ ./node_modules_dev/ant-design-vue/lib/index.js
14:02:23.188   @ ./plugins/antd-ui.js
14:02:23.188   @ ./.nuxt/index.js
14:02:23.188   @ ./.nuxt/server.js
14:02:23.188   @ multi ./node_modules_dev/@nuxt/components/lib/installComponents.js ./.nuxt/server.js�[39m�[22m
14:02:23.188  ℹ Ready to run nuxt start
14:02:23.718  ℹ Nuxt build took: 37141.950478 ms
14:02:23.718   ----------------- Install dependencies ----------------- 
14:02:23.720  Running npm install
14:02:34.813  > core-js@3.6.5 postinstall /vercel/30aec542/node_modules/@firebase/polyfill/node_modules/core-js
14:02:34.813  > node -e "try{require('./postinstall')}catch(e){}"
14:02:34.869  �[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
14:02:34.869  �[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: �[0m
14:02:34.869  �[96m>�[94m https://opencollective.com/core-js �[0m
14:02:34.869  �[96m>�[94m https://www.patreon.com/zloirock �[0m
14:02:34.869  �[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
14:02:34.898  > core-js@3.6.5 postinstall /vercel/30aec542/node_modules/plyr/node_modules/core-js
14:02:34.898  > node -e "try{require('./postinstall')}catch(e){}"
14:02:34.954  �[96mThank you for using core-js (�[94m https://github.com/zloirock/core-js �[96m) for polyfilling JavaScript standard library!�[0m
14:02:34.954  �[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: �[0m
14:02:34.954  �[96m>�[94m https://opencollective.com/core-js �[0m
14:02:34.954  �[96m>�[94m https://www.patreon.com/zloirock �[0m
14:02:34.954  �[96mAlso, the author of core-js (�[94m https://github.com/zloirock �[96m) is looking for a good job -)�[0m
14:02:34.958  > protobufjs@6.9.0 postinstall /vercel/30aec542/node_modules/protobufjs
14:02:34.958  > node scripts/postinstall
14:02:35.242  added 368 packages from 348 contributors and audited 368 packages in 11.124s
14:02:35.349  34 packages are looking for funding
14:02:35.349    run `npm fund` for details
14:02:35.349  found 0 vulnerabilities
14:02:35.369  ℹ Install dependencies took: 11650.396354 ms
14:02:35.369   ----------------- Collect artifacts ----------------- 
14:02:44.769  ℹ Collect artifacts took: 9395.286763 ms
14:02:45.005  Uploading build outputs...
14:02:48.319  Build completed. Populating build cache...
14:02:48.321   ----------------- Collect cache ----------------- 
14:02:48.325  ℹ 0 files collected from .now_cache
14:02:51.191  ℹ 46904 files collected from node_modules_dev
14:02:51.813  ℹ 10671 files collected from node_modules_prod
14:02:51.820  ℹ Collect cache took: 3498.353262 ms
14:03:08.001  Uploading build cache [67.34 MB]...
14:03:09.066  Build cache uploaded: 1064.256ms
14:03:09.083  Done with "nuxt.config.js"
```

s3i7h added a commit to aeroworks-io/nuxtfire-vercel-template that referenced this issue Jul 28, 2020
spaceninja added a commit to spaceninja/book-list-nuxt that referenced this issue Dec 9, 2020
@alexkasongo
Copy link

I'm still having this issue. Any update?

@danielroe
Copy link
Member

@alexkasongo Check your Vercel logs for the cause and consider/try explanations above ☝️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

10 participants