Inserting uuid into sqlite Database in node doesnt work - javascript

I am currently working on inserting a uuid-value like this one:
c1f9ff70-71e8-11eb-8b1b-77c34b246f91
into a sqlite database. This is my insert-Statement:
this.db.serialize(() => {
this.db.prepare(`CREATE TABLE IF NOT EXISTS bestellung(bid BLOB PRIMARY KEY, drink TEXT,price REAL,validation TEXT)`).run().finalize();
});
//FUNKTIONIERT!
const bidJSON = getBID();
const name = 'Testdrink';
const preis = 12.90;
const kpreis = preis.toFixed(2);
preis.toFixed(2);
console.log(bidJSON.id);
console.log(name);
console.log(kpreis);
var statement = "INSERT INTO bestellung(bid, drink, price, validation) VALUES(`" + bidJSON.id + "`,`" + name + "`,`" + kpreis + "`, `pending`)";
this.db.prepare(statement);
This is the error I get:
[Error: SQLITE_ERROR: no such column: c1f9ff70-71e8-11eb-8b1b-77c34b246f91
Emitted 'error' event on Statement instance at:
] {
errno: 1,
code: 'SQLITE_ERROR'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bk#0.0.0 start: `node app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bk#0.0.0 start 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! C:\Users\prakt\AppData\Roaming\npm-cache\_logs\2021-02-18T12_56_46_751Z-debug.log
I hope someone can help me!
For experienced programmers it should be an easy task.
I think it will probably be a mistake in my statement. I already read, that you can save the uuid into a blob and that this is the fastest way of saving it...
so i would like to stick to that.
Thank you in advance!

Related

TypeError: Cannot read property 'length' of undefined - While deploying using hardhat

I am getting the following error while trying to deploy a Mock contract on the hardhat development chain.
I am following:
Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course by Patrick Collins on FreeCodeCamp YT channel
I got this error while I was at 10:48:53 of the above course. I tried almost every thing but nothing helped but I found where the problem was occurring.
Ques: Where do I think the problem is occurring? (12:26)
According to me the problem is at the line where we are trying to deploy the script and we are waiting for the promise to be returned.
Here is the error:
Error: ERROR processing /Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/deploy/00-deploy-mocks.js:
TypeError: Cannot read property 'length' of undefined
at getFrom (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/helpers.ts:1713:14)
at _deploy (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/helpers.ts:533:9)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at _deployOne (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/helpers.ts:1004:16)
at Object.module.exports [as func] (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/deploy/00-deploy-mocks.js:12:26)
at DeploymentsManager.executeDeployScripts (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1219:22)
at DeploymentsManager.runDeploy (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1052:5)
at SimpleTaskDefinition.action (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/index.ts:438:5)
at Environment._runTaskDefinition (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at DeploymentsManager.executeDeployScripts (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1222:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at DeploymentsManager.runDeploy (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1052:5)
at SimpleTaskDefinition.action (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/index.ts:438:5)
at Environment._runTaskDefinition (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at SimpleTaskDefinition.action (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/index.ts:584:32)
at Environment._runTaskDefinition (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat/src/internal/core/runtime-environment.ts:219:14)
at Environment.run (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat/src/internal/core/runtime-environment.ts:131:14)
at SimpleTaskDefinition.action (/Users/rishavsharma/Documents/working/Web Dev/Blockchain/Freecodecamp/solidity&Block/blockchain-with-js/buyMeACoffee-dapp/node_modules/hardhat-deploy/src/index.ts:669:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
rishavsharma#Rishavs-Air buyMeACoffee-dapp %
Here is the code snippet in which I am getting the error:
const { network } = require("hardhat");
const { developmentChains, DECIMALS, INITIAL_ANSWER } = require("../helper-hardhat-config");
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = network.config.chainId;
if (chainId == 31337) {
console.log("Development network detected! Deploying mocks...");
const feedMock = await deploy("MockV3Aggregator", {
contract: "MockV3Aggregator",
from: deployer,
log: true,
args: [DECIMALS, INITIAL_ANSWER],
});
log("Price Feed Mock deployed!");
log("==============================================");
}
}
module.exports.tags = ["all", "mocks"];
Please help me with this problem 🥹
I posted this question on Ethereum Stack Exchange but got no help.
System configuration: MacBook Air M1 2021 - Monterey 12.4, yarn: 1.22.18, Hardhat: 2.9.6
I got the answer from the MASTER himself, #PatrickAlphaC.
When we call await getNamedAccounts in the above code, hardhat looks for the length of the named accounts in our hardhat.config.js
We have to make sure that the property given below is in there!
namedAccounts: {
deployer: {
default: 0, // here this will by default take the first account as deployer
},
},
This solved my problem and I was HAPPY again!
Make sure you have await in getNamedAccount(). Also name must be correct.
Must have correct entry for named accounts as below:
namedAccounts: {
deployer: {
default: 0,
deployer
1: 0,
},
},
I was stuck for a while with this as well, and was also following this same course.
Cannot read properties of undefined (reading 'length')
at getFrom (/Users/ilima/hh-fcc/hardhat-fundme-fcc/node_modules/hardhat-deploy/src/helpers.ts:1713:14)
at _deploy (/Users/ilima/hh-fcc/hardhat-fundme-fcc/node_modules/hardhat-deploy/src/helpers.ts:533:9)
Initially I was writing from scratch and kept getting this error and plus hardhat npm installation. I decided to test just in case the course code, so I cloned the repo and surprisingly was also struggling with npm install issues for hardhat and waffle.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hardhat-project#undefined
npm ERR! Found: #nomiclabs/hardhat-ethers#0.3.0-beta.13
npm ERR! node_modules/#nomiclabs/hardhat-ethers
npm ERR! dev #nomiclabs/hardhat-ethers#"npm:hardhat-deploy- ethers#^0.3.0-beta.13" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #nomiclabs/hardhat-ethers#"^2.0.0" from #nomiclabs/hardhat-waffle#2.0.2
npm ERR! node_modules/#nomiclabs/hardhat-waffle
npm ERR! dev #nomiclabs/hardhat-waffle#"^2.0.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
So fixing dependency hardhat-ethers by overriding it, fixed all issues for me, so try this:
"devDependencies": {
...
"#nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers#^0.3.0-beta.13",
...
},
"overrides": {
"#nomiclabs/hardhat-waffle": {
"#nomiclabs/hardhat-ethers": "$#nomiclabs/hardhat-ethers"
}
}
I got solution from Installation advice breaks #nomiclabs/hardhat-waffle
Now, I noticed that you have already solved your problem, but I wanted to add my solution as well just in case if someone else is struggling with deploy being undefined in terminal. In my case namedAccounts and await getNamedAccount() was fine.

I'm building a Slack Bot but getting an error

I was trying to build a Slack Bot in Node but always seem to get this error when I run npm start in my terminal :
It shows an error in the Vow.js file. I checked everything twice but can't find the problem. For reference, I was following along this youtube toturial from Brad Traversy https://www.youtube.com/watch?v=nyyXTIL3Hkw
> alfalfa#1.0.0 start /Users/ayushpathak/Documents/alfalfa
> node index.js
/Users/ayushpathak/Documents/alfalfa/node_modules/vow/lib/vow.js:105
throw e;
^
Error: not_allowed_token_type
at /Users/ayushpathak/Documents/alfalfa/node_modules/slackbots/index.js:46:33
at Array.<anonymous> (/Users/ayushpathak/Documents/alfalfa/node_modules/vow/lib/vow.js:773:56)
at callFns (/Users/ayushpathak/Documents/alfalfa/node_modules/vow/lib/vow.js:24:35)
at processTicksAndRejections (node:internal/process/task_queues:75:11)
Emitted 'error' event on Bot instance at:
at /Users/ayushpathak/Documents/alfalfa/node_modules/slackbots/index.js:46:19
at Array.<anonymous> (/Users/ayushpathak/Documents/alfalfa/node_modules/vow/lib/vow.js:773:56)
at callFns (/Users/ayushpathak/Documents/alfalfa/node_modules/vow/lib/vow.js:24:35)
at processTicksAndRejections (node:internal/process/task_queues:75:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! alfalfa#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the alfalfa#1.0.0 start 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! /Users/ayushpathak/.npm/_logs/2021-01-24T08_41_17_374Z-debug.log
Here's package.json :
"name": "alfalfa",
"version": "1.0.0",
"description": "a slackbot that does, well, everything",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "Ayush Pathak",
"license": "MIT",
"dependencies": {
"axios": "^0.21.1",
"slackbots": "^1.2.0"
}
}
Here's index.js
const SlackBot = require('slackbots');
const Axios = require('axios');
const bot = new SlackBot({
token : 'I PUT THE TOKEN HERE',
name : 'alfalfa_beta',
});
bot.on('start', () => {
const params ={
icon_emoji : ":eyes:"
}
bot.postMessageToChannel('general', 'Initiated!')
})
So the token that needed to be added in slackbot is the jwt-token you get from https://api.slack.com/ when you are creating a new bot/app it cannot be any random string.
You can get the rest necessary details over here https://api.slack.com/methods/apps.permissions.info

Can you help me to solve this error about json?

I'm trying to connect Firebase using node.js
I have following code in my json file.
const functions = require('firebase-functions');
const hmac_sha256= require ('crypto-js/hmac_sha256');
const request= require('request');
const admin= require('firebase-admin');
const service_Account= require('./service_account_key.json');
const firebaseConfig= json.parse(process.env.FIREBASE_CONFIG);
firebaseConfig.credential= admin.credential.cert("service_Account");
admin.initializeApp(firebaseConfig);
exports.getCustomToken = functions.https.onRequest((req,res)=>{
const accessToken= req.query.access_Token;
const FacebookAppSec= '72100b8d4ee21a85fc67d014f3b0c9fa';
const AppSecretProof= hmac_sha256(accessToken,FacebookAppSec);
//Validate token...
const uri='https://graph.accountkit.com/v1.1/me?access_Token=${accessToken}&App_Proof=${AppSecretProof}';
request({
url= uri,
json:true
},(error,fbresponse,data)=>{
if(error)
{
console.error('Access Token validation request failed\n',error);
res.status(400).send(error);
}
else if(data.error)
{
console.error('Invalid Access Token\n',
'access_Token=${accessToken}',
'App_Proof=${AppSecretProof}',data.error);
res.status(400).send(data);
}
else
{
admin.auth().createCustomToken(data.id)
.then(CustomToken => res.status(200).send(CustomToken))
.catch(error => {
console.error('Create Custom Token Failed.',error);
res.status(400).send(error);
})
}
})
})
After using command-firebase deploy I got this
> G:\New folder\firebase_functions>firebase deploy
=== Deploying to 'eatitv2-8aa15'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions# lint G:\New folder\firebase_functions\functions
> eslint .
G:\New folder\firebase_functions\functions\index.js
19:9 error Parsing error: Shorthand property assignments are valid only in destructuring patterns
✖ 1 problem (1 error, 0 warnings)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions# lint: `eslint .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions# lint 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! C:\Users\Maaz Farooq\AppData\Roaming\npm-cache\_logs\2020-07-18T16_58_24_083Z-debug.log
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn npm --prefix "%RESOURCE_DIR%" run lint ENOENT
at notFoundError (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\Maaz Farooq\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn npm --prefix "%RESOURCE_DIR%" run lint',
path: 'npm --prefix "%RESOURCE_DIR%" run lint',
spawnargs: []
}
Error: functions predeploy error: Command terminated with non-zero exit code1
I see many answers on stack overflow as well as on github, but nothing proceed. i have tried my best to solve it by myown also get help from online community but now posting this to all of you.
The output shows that ESLint is giving you this error message on line 19 of index.js:
19:9 error Parsing error: Shorthand property assignments are valid only in destructuring patterns
Line 19 is url= uri below:
request({
url= uri,
json:true
},(error,fbresponse,data)=>{
If you want to give values to properties in a JavaScript objects, you have to use : instead of =, just like you did with json:true.
request({
url: uri,
json:true
},(error,fbresponse,data)=>{

Why can't I deploy this code to firebase functions? I don't understand the error

I'm new to firebase functions - obviously - and I'm trying to test to see if an email in that specific path of the database when created is being used by an account if it isn't being used then change that database value accordingly. Here's the code:
exports.checkEmail = functions.database.ref('/checkEmailExistance')
.onCreate((snapshot, context) => {
// Grab the current value of what was written to the Realtime Database.
const email = snapshot.val();
console.log('Email:', email, context.params.pushId);
admin.auth().getUserByEmail(email)
.then(snapshot => {
const data = snapshot.toJSON()
return admin.database().ref('checkEmailExistance').child(email).set("Nope")
})
});
and the error is:
ERROR: /Users/nathan/Documents/FirebaseFunctionsClipify/functions/src/index.ts:41:7 - Promises must be handled appropriately
ERROR: /Users/nathan/Documents/FirebaseFunctionsClipify/functions/src/index.ts:42:13 - Shadowed name: 'snapshot'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions# lint: `tslint --project tsconfig.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions# lint 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! /Users/nathan/.npm/_logs/2019-04-25T16_21_29_696Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2
UPDATE:
I changed the code so the errors shouldn't be produced again, but still got the same error:
exports.checkEmail = functions.database.ref('/checkEmailExistance')
.onCreate((snapshot, context) => {
// Grab the current value of what was written to the Realtime Database.
const email = snapshot.val();
console.log('Email:', email, context.params.pushId);
return admin.auth().getUserByEmail(email)
.then(snap => {
const data = snap.toJSON()
return admin.database().ref('checkEmailExistance').child(email).set("Nope")
})
});
The second error is telling you that you redefined an existing variable called snapshot. Note that snapshot is defined by at the top level of your function callback, then again in the then callback. The second instance is "shadowing" the first, which is a potential error in your code. Just name the second variable something different.
The first lint error is telling you that you have an unhandled promise in your code. You can fix this by returning the promise from admin.auth().getUserByEmail().then(...):
return admin.auth().getUserByEmail(email)
.then(snap => {
const data = snap.toJSON()
return admin.database().ref('checkEmailExistance').child(email).set("Nope")
})

Why is bcrypt showing errors on TravisCI?

I am running tests on TravisCI but at the point, npm test is triggered, this error is thrown:
> store-manager#1.0.0 test /home/travis/build/danoseun/Store-Manager
> npm run createTables && nyc --reporter=html --reporter=text mocha ./server/tests/*.js --exit --compilers js:babel-core/register
> store-manager#1.0.0 createTables /home/travis/build/danoseun/Store-Manager
> babel-node -- ./server/db/dbTables
/home/travis/build/danoseun/Store-Manager/node_modules/bcrypt/bcrypt.js:92
throw new Error('data and salt arguments required');
^
**Error: data and salt arguments required**
at Object.hashSync (/home/travis/build/danoseun/Store-Manager/node_modules/bcrypt/bcrypt.js:92:15)
at Object.<anonymous> (/home/travis/build/danoseun/Store-Manager/server/db/dbTables/seedAdmin/insertAdmin.js:6:28)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at loader (/home/travis/build/danoseun/Store-Manager/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/travis/build/danoseun/Store-Manager/node_modules/babel-register/lib/node.js:154:7)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! store-manager#1.0.0 createTables: `babel-node -- ./server/db/dbTables`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the store-manager#1.0.0 createTables 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! /home/travis/.npm/_logs/2019-01-15T14_24_23_739Z-debug.log
npm ERR! Test failed. See above for more details.
The command "npm test" exited with 1.
cache.2
store build cache
0.00s2.35snothing changed, not updating cache
Done. Your build exited with 1.
This is the way, the insertAdmin.js file looks like:
import bcrypt from 'bcrypt';
import pool from '../../connection';
const sql = 'insert into users (email, password, role) values ($1, $2, $3)';
const password = process.env.PASSWORD;
const newPassword = bcrypt.hashSync(password, 10);
const email = process.env.EMAIL;
const variables = [email, newPassword, 'admin'];
I also tried to restructure the file to use asynchronous hashing but it still didn't work.
const sql = 'insert into users (email, password, role) values ($1, $2, $3)';
const password = process.env.PASSWORD;
async function value() {
console.log('HERE', bcrypt.hash(password, 10))
const hashPassword = await bcrypt.hash(password, 10);
console.log('OYA', hashPassword);
return hashPassword;
}
const email = process.env.EMAIL;
const variables = [email, value(), 'admin'];
console.log('NOW', variables[1]);
console.log(bcrypt.hash(password, 10)) and console.log(hashPassword) return the correct values but console.log(variables[1]) returns an empty object.
I don't understand what could be wrong.
PS: I just did something. I unintentionally pushed the console.log(process.env.PASSWORD) in that file to github and integrated it with travis and behold, the line where I did console.log shows that process.env.PASSWORD is undefined. I have made further steps to import dotenv or dtenv/config but it's still undefined. What do I do?
process.env.PASSWORD is probably undefined since you forgot to configure environment variables on Travis CI. Since passwords are usually confidential, you should set the variable in the settings page of your repo, which will encrypt the password and keep it secret. See more info on how to do that here.
To add to the upvoted answer, data and salt arguments required error in bcrypt is thrown when one of the arguments to bcrypt.hashSync method is null according to https://github.com/kelektiv/node.bcrypt.js/blob/master/bcrypt.js line 92. To solve this on Travis, click on more options-settings and environmental variables on TravisCI of the repository and add(with the add button) the respective key as was specified in your .env file. Build should automatically restart and see it pass if other things are equal.

Categories

Resources