VirgilSecurity / virgil-e3kit-firebase-func

Backend's function that connects your Virgil and Firebase accounts for implementing end-to-end encryption
https://developer.virgilsecurity.com/docs/use-cases/v5/encrypted-communication-for-firebase
BSD 3-Clause "New" or "Revised" License
21 stars 6 forks source link

Error while deploying Cloud Functions #9

Closed 3llomi closed 5 years ago

3llomi commented 5 years ago

i am getting the error Error: Illegal arguments for function privateKeyToDER when i run the command firebase deploy --only functions Node version: 10.16.0 here is the log

Desktop/e2e_test/virgil-e3kit-firebase-func/functions/node_modules/virgil-crypto/dist/virgil-crypto.cjs.js:223:32)
    at Object.privateKeyToDer (Desktop/e2e_test/virgil-e3kit-firebase-func/functions/node_modules/virgil-crypto/dist/virgil-crypto.cjs.js:408:41)
    at VirgilCrypto.importPrivateKey (/Desktop/e2e_test/virgil-e3kit-firebase-func/functions/node_modules/virgil-crypto/dist/virgil-crypto.cjs.js:1364:43)
    at Object.<anonymous> (Desktop/e2e_test/virgil-e3kit-firebase-func/functions/lib/generate-virgil-jwt.js:18:20)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)

any thoughts about this?

xLEWKANx commented 5 years ago

Hi @3llomi We changed structure of the configuration file. I've updated this repository, so please pull last changes

git pull

then, run configuration again:

npm run configure

and try to deploy again:

firebase deploy --only functions

Please write if you'll have some problems.

3llomi commented 5 years ago

Thanks! it's working now

3llomi commented 5 years ago

@xlwknx i've got the same issue again now after updating to latest version (on a new project). can you check it please?

xLEWKANx commented 5 years ago

@3llomi Did you use same config file? If so, we changed the format for configuration file. You can download a new one on the Virgil Dashboard in E3Kit section.

  1. Or rename it to .env;
  2. Change format from JSON to env
APP_ID=7bc750be191344fea619fb232586fb05
APP_KEY_ID=ccb8e6c13469cbebdf83881d133593ed
APP_KEY=YOUR_PRIVATE_KEY
3llomi commented 5 years ago

@xlwknx i just went to Virgil Dashboard and i saw that you've changed the Button 'Generate Config' file to 'Generate .env' file, so i downloaded this file and rename it to .env and now everything is working great. Thanks Man!

jWarrenDev commented 5 years ago

Hi! I am actually having the same issues and I have also git pulled and it is up to date. Error: Illegal arguments for function privateKeyToDER

xLEWKANx commented 5 years ago

Hi, @jWarrenDev Please make sure, that you followed instruction correctly. If problem occurs again, send here next information:

  1. Output of npm run configure command.
  2. Screenshot of files in repository with extensions (should look like this): Screenshot 2019-10-31 at 12 02 10
jWarrenDev commented 5 years ago

Thank You! It seems that when the .env file is downloaded it formats it as a .txt file. Even after renaming the file I had to go into "get info" and make sure the .txt was removed. That fixed the error.