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

Unable to deploy to AWS EBS #105

Closed
srameshr opened this issue Oct 10, 2017 · 12 comments
Closed

Unable to deploy to AWS EBS #105

srameshr opened this issue Oct 10, 2017 · 12 comments

Comments

@srameshr
Copy link

srameshr commented Oct 10, 2017

[REQUIRED] Step 2: Describe your environment

  • Operating System version: AWS Ubuntu Linux 16
  • Firebase SDK version: 5.4.2
  • Library version:
  • Firebase Product: Messaging (Admin sdk)

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

npm install --save firebase-admin and run eb-deploy
The deploy fails with:

============= i-05310204bd3adbe90 ==============
-------------------------------------
/var/log/nodejs/nodejs.log
-------------------------------------

module.js:487
    throw err;
    ^

Error: Cannot find module 'grpc'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/var/app/current/node_modules/firebase-admin/node_modules/@google-cloud/common-grpc/src/service.js:26:12)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Frills@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Frills@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

┌──────────────────────────────────────────────────┐
│             npm update check failed              │
│       Try running with sudo or get access        │
│       to the local update config store via       │
│ sudo chown -R $USER:$(id -gn $USER) /tmp/.config │
└──────────────────────────────────────────────────┘

> App@1.0.0 start /var/app/current

Here is my package.json

{
  "name": "App",
  "version": "1.0.0",
  "description": "App backend code",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/ParsePlatform/parse-server-example"
  },
  "license": "MIT",
  "dependencies": {
    "body-parser": "^1.17.2",
    "express": "^4.15.4",
    "firebase-admin": "5.2.1",
    "kerberos": "~0.0.x",
    "parse": "^1.10.0",
    "parse-server": "^2.6.0",
    "pug": "^2.0.0-rc.4",
    "shortid": "^2.2.8"
  },
  "scripts": {
    "start": "node index.js"
  },
  "engines": {
    "node": ">=4.3"
  }
}

@hiranya911
Copy link
Contributor

hiranya911 commented Oct 10, 2017

Can you check if the grpc package is installed under node_modules?

@srameshr
Copy link
Author

How do I check the contents of node_modules folder in ebs? In my local node_modules folder I see the grpc lib.

@hiranya911
Copy link
Contributor

This should be fixed now: https://firebase.google.com/support/release-notes/admin/node#5.4.3

We no longer load Firestore/gRPC packages unless admin.firestore() is called explicitly.

@shadow1349
Copy link

shadow1349 commented Feb 13, 2018

@hiranya911
This still doesn't work for me. I can't deploy to EB if I have firebase-admin greater than 4.2.1

I have to use firestore for my project, are there any workarounds?

Also, when I take out any firestore call (it was easy as I was only using it in one place) I get

  Failed to execute '/opt/elasticbeanstalk/node-install/node-v8.8.1-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.8.1-linux-x64/lib/node_modules/n
pm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/tmp/deployment/application/node_modules/grpc/src/node/ex
tension_binary/node-v57-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/tmp/deployment/application/node_modules/grpc/src/node/extension_bina
ry/node-v57-linux-x64-glibc' (1)
  npm WARN covebot-mbf@0.0.1 No repository field.

  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! grpc@1.7.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
  npm ERR! Exit status 1
  npm ERR!
  npm ERR! Failed at the grpc@1.7.3 install script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

  npm ERR! A complete log of this run can be found in:
  npm ERR!     /tmp/.npm/_logs/2018-02-13T03_32_49_130Z-debug.log
  Running npm install:  /opt/elasticbeanstalk/node-install/node-v8.8.1-linux-x64/bin/npm
  Setting npm config jobs to 1
  npm config jobs set to 1
  Running npm with --production flag
  Failed to run npm install. Snapshot logs for more details.
  UTC 2018/02/13 03:32:49 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log

  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
      main()
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
      node_version_manager.run_npm_install(options.app_path)
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
      self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
      raise e
  subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v8.8.1-linux-x64/bin/npm', '--production', 'install']' returned non-zero exitstatus 1 (Executor::NonZeroExitStatus)

So I can't use it even if I don't call firestore

@rosskhanas
Copy link

@shadow1349 I switched from NPM to yarn on EB and it works great now.

@shadow1349
Copy link

@rtkhanas I'm afraid I can't switch my whole company over to yarn

@rosskhanas
Copy link

@shadow1349 anyway the problems looks like NPM is installing some dependencies to a wrong folder on AWS. Maybe, not really related to firebase-admin-node, but more to NPM itself.

@yerassyl
Copy link

Hello all, have this issue been resolved? I am getting it too. Any suggestions?

@albinekb
Copy link

I have this issue too, we we're running t2.micro with 512MB ram, but compiling GRPC module seems to only work with t2.medium (4GB ram). Why is this package installed when I'm just using firebase.messaging() ?

@ehansen31
Copy link

appreciate you @albinekb , upgraded t2.mico => t2.medium and it worked.

@sthielen
Copy link

sthielen commented Jan 8, 2019

For any latecomers to this thread: I encountered this issue when deploying to Elastic Beanstalk. Installing grpc was breaking during node-gypwith a permission error:

node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/grpc/src/node'

I was able to resolve temporarily by installing with unsafe-perm=true as detailed here.

@zackshapiro
Copy link

@sthielen thank you. This worked perfectly for me

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

No branches or pull requests

9 participants