I have a graphql project using the prism but when executing the command npx prisma deploy -e ../config/dev.env I get the following error:
post-deploy:
[
"[WARNING] in D:\\Projetos\\graphql3\\graphql-prisma\\prisma\\prisma.yml: A valid environment variable to satisfy the declaration 'env:PRISMA_ENDPOINT' could not be found."
]
ListrError: Something went wrong
at D:\Projetos\graphql3\graphql-prisma\node_modules\listr\index.js:102:18
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async executeCodegen (D:\Projetos\graphql3\graphql-prisma\node_modules\#graphql-codegen\cli\index.cjs.js:812:5)
at async Object.generate (D:\Projetos\graphql3\graphql-prisma\node_modules\#graphql-codegen\cli\index.cjs.js:1102:25)
at async Object.handler (D:\Projetos\graphql3\graphql-prisma\node_modules\#graphql-cli\codegen\index.cjs.js:23:13) {
errors: [
Error: No cluster set. Please set the "cluster" property in your prisma.yml
at PrismaLoader.load (D:\Projetos\graphql3\graphql-prisma\node_modules\#graphql-tools\prisma-loader\index.cjs.js:1296:19)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async loadFile (D:\Projetos\graphql3\graphql-prisma\node_modules\#graphql-tools\load\index.cjs.js:48:24)
at async D:\Projetos\graphql3\graphql-prisma\node_modules\#graphql-tools\load\index.cjs.js:425:24 {
source: './src/generated/prisma.graphql',
context: [Object: null prototype] {}
}
],
context: [Object: null prototype] {}
}
The project's folder architecture is in this format
my prisma.yml
endpoint: ${env:PRISMA_ENDPOINT}
datamodel: datamodel.graphql
secret: thisisasecret
hooks:
post-deploy:
- graphql codegen --project database # instead of graphql get-schema
# - prisma generate**strong text**
config\dev.env has content
PRISMA_ENDPOINT=http://localhost:4466
package.json
{
"name": "graphql-basics",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon src/index.js --ext js,graphql --exec babel-node",
"test": "echo \"Error: no test specified\" && exit 1",
"get-schema": "graphql codegen --project database"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"bcryptjs": "^2.4.3",
"env-cmd": "^10.1.0",
"graphql-cli": "^4.0.0",
"graphql-yoga": "^1.14.10",
"jsonwebtoken": "^8.5.1",
"prisma-binding": "^2.3.16"
},
"devDependencies": {
"#graphql-cli/codegen": "^1.17.8",
"#graphql-codegen/schema-ast": "^1.17.8",
"nodemon": "^1.17.5"
}
}
I didn't find anything related and even trying to put the .env in the root where the prisma.yml file is, with the default name .env doesn't work
Related
I get yarn loops when starting my server.
>Console Listener setup OK
>Started map fivem-map-hipster
>Started resource fivem-map-hipster
>[yarn] yarn install v1.22.5
>[yarn] [1/4] Resolving packages...
and then it loops and tries to resolve the package again.
My package.json looks like this:
{
"name": "webpack-builder",
"version": "1.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"async": "^3.1.0",
"webpack": "^4.41.2",
"worker-farm": "^1.7.0"
}
}
what am I missing?
As you can see the error but i have declared everything corrctly still i am getting this error. my server.js file is present inside the backend folder.
my package.json
{
"name": "mern",
"version": "1.0.0",
"description": "MERN Develeopment",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon backend/server.js",
"client": "npm start --prefix frontend",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix frontend"
},
"author": "Rahul Kumar",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"express-async-handler": "^1.2.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.13.15",
"nodemon": "^2.0.19"
}
}
Procfile - web:node backend/server.js
anybody please help on this.
I am able to merge and generate reports in my local but when I am running mt test into GitHub action through error ERROR: Failed to merge reports. I never used GitHub action before so maybe I have made a mistake. Any suggestions are welcome.
Here is my cypress.json file
{
"reporter": "cypress-mochawesome-reporter",
"reporterOptions": {
"reportDir": "cypress/Reports",
"charts": true,
"overwrite": false,
"html": false,
"json": true,
"reportPageTitle": "Legrande Cypress",
"reportFilename": "Legrande Cypress Test Report",
"embeddedScreenshots": true,
"inlineAssets": true
},
"defaultCommandTimeout": 30000,
"retries": {
"runMode": 1,
"openMode": 1
},
"video": false,
"scrollBehavior": "nearest",
"chromeWebSecurity": false,
}
Here is my package.json file.
{
"name": "cypressautomation",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"delete:reportFolder": "rm -rf mochawesome-report/",
"test:cli": "npm run delete:reportFolder && cypress run",
"merge:reports": "mochawesome-merge mochawesome-report/*.json > cypress-combined-report.json",
"create:html:report": "npm run merge:reports && marge --reportDir TestReport cypress-combined-report.json",
"cy:run": "cypress run",
"record-test": "cypress run --record --key ######################"
},
"reporter": "cypress-mochawesome-reporter",
"reporterOptions": {
"reportDir": "cypress/Reports",
"charts": true,
"reportPageTitle": "My Test Suite",
"embeddedScreenshots": true,
"inlineAssets": true
},
"video": false,
"author": "weblylab",
"license": "ISC",
"devDependencies": {
"cypress": "^9.5.0",
"cypress-file-upload": "^5.0.2",
"cypress-mochawesome-reporter": "^2.2.0",
"cypress-slack-reporter": "^1.2.1",
"cypress-xpath": "^1.6.1",
"faker": "^5.5.3",
"i": "^0.3.6",
"mocha": "^8.4.0",
"mochawesome": "^6.2.2",
"mochawesome-merge": "^4.2.0",
"mochawesome-report-generator": "^5.2.0",
"tsconfig-paths": "^3.9.0"
},
"dependencies": {
"#auth0/auth0-spa-js": "^1.13.6",
"#types/bluebird": "^3.5.33",
"#types/lodash": "^4.14.168",
"chai": "^4.3.0",
"cypress-iframe": "^1.0.1",
"cypress-skip-test": "^1.0.0",
"delay": "^5.0.0",
"Faker": "^0.7.2",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"resolve-url": "^0.2.1",
"save": "^2.4.0",
"source-map-resolve": "^0.6.0",
"urix": "^0.1.0",
"xlsx": "^0.17.0"
}
}
And here is my cypress.yml file that I used for GitHub action.
name: GitHub Actions Demo
on:
schedule:
- cron: "0 0 * * *"
push:
branches:
- 'master'
jobs:
cypress-test:
name: Run on windows
runs-on: windows-latest
steps:
- uses: actions/checkout#v2
- name: Install dependencies
run: |
npm install
npm install --dev
npm run record-test
- name: Copy execution test screenshots
run: |
mkdir public
cp -r cypress/screenshots public/screenshots
- name: Merge test reports
run: npm run merge:reports
- name: Generate HTML reports
run: npm run create:html:report
I am getting the below error for merging reports. In my local machine, it working fine.
Did you try to change the
"reportDir": "cypress/Reports",
to the mochawesome-report
"reportDir": "cypress/reports/mochawesome-report",
Also, check your plugins/index.js
on('before:run', async (details) => {
console.log('Override before:run');
await beforeRunHook(details);
// Note: if you are using other than Windows remove below two lines, start with await exec
//await exec("IF EXIST cypress\\screenshots rmdir /Q /S cypress\\screenshots")
//await exec("IF EXIST cypress\\reports rmdir /Q /S cypress\\test-reports")
//await exec("IF EXIST cypress\\reports rmdir /Q /S cypress\\reports")
});
on('after:run', async () => {
console.log('Override after:run');
// Note: if you are using other than Windows remove below line, starts with await exec
//await exec("npx jrm ./cypress/reports/junitreport.xml ./cypress/test-reports/junit-report-[hash].xml");
//await exec("npx jrm ./cypress/reports/junitreport.xml ./cypress/reports/junit-report-[hash].xml");
await afterRunHook();
});
I had similar issues and solved some of them with
reporter: '../node_modules/cypress-mochawesome-reporter',
video: true,
reporterOptions: {
reportDir: 'reports/mochawesome',
That said, I found a reference saying that you need a relative directory now for reportDir, so I suspect that my reportDir above is only working because I happened to select the default directory used by Mochawesome.
Update #1
Unfortunately, I cannot find a screenshot from when I was working on the issue using postgrator. I ended up going with knex to try and connect to heroku instead.
However, when I run 'heroku run npm run migrate' I run into the following issue:
heroku run knex migrate:latest
Running knex migrate:latest on ⬢ stormy-hollows-73700... up,
run.6282 (Free)
Error: self signed certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1507:34)
at TLSSocket.emit (events.js:376:20)
at TLSSocket._finishInit (_tls_wrap.js:932:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12)
package.json
{
"name": "express-boilerplate",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"migrate": "knex migrate:latest",
"create-migration": "knex migrate:make $1",
"migrate:test": "env NODE_ENV=test npm run migrate",
"seed": "psql -d chirp-app -f seeds/seed.posts.sql; psql -d chirp-
app -f seeds/seed.replies.sql",
"test": "mocha --require test/setup.js",
"dev": "nodemon src/server.js",
"start": "node src/server.js",
"predeploy": "npm audit",
"deploy": "git push heroku main"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"helmet": "^4.2.0",
"knex": "^0.95.4",
"morgan": "^1.10.0",
"pg": "^8.0.3",
"postgrator-cli": "^3.3.0",
"uuid": "^8.3.2",
"xss": "^1.0.8"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^8.2.1",
"nodemon": "^2.0.7",
"supertest": "^6.0.1"
}
}
knexfile.js
`const dotenv = require('dotenv')
dotenv.config()
module.exports = {
client: 'pg',
connection: process.env.DATABASE_URL,
ssl: { rejectUnauthorized: false }
};`
knex migration:
`exports.up = function (knex) {
return Promise.all(
[knex.schema.createTable('posts', table => {
table.string('id', 36)
table.string('title', 50)
table.string('content')
}),
knex.schema.createTable('replies', table => {
table.string('id', 36)
table.string('title', 50)
table.string('postid', 36)
})]
)
};
exports.down = function (knex) {
knex.schem.dropTable('posts')
knex.schema.dropTable('replies')
};`
Let me know if I should present this information differently, add or remove files as I am learning how to use this platform.
Thanks!
I ended up creating a knex migration and was able to validate my database on heroku.
I did have to make a "seed:live" script that runs seeds using postgres though.
ex:
"scripts": {..."seed:live": "heroku pg:psql -f seeds/seed.posts.sql; heroku pg:psql -f seeds/seed.replies.sql"...}
to validate seeding the database:
heroku pg:psql -f seeds/seed.posts.sql; heroku pg:psql -f seeds/seed.replies.sql --> Connecting to postgresql-cubed-11974 INSERT 0 3 --> Connecting to postgresql-cubed-11974 INSERT 0 2
but now it works!
My team and I created a MERN stack application (M for MySQL) that is planning on hosting our client on gh-pages and our server on heroku. So far we have been unable to deploy because we keep getting errors about our use of the npm package concurrently. Although we can access our heroku url and our gh-pages url, we are unable to connect the two
We have already tried adding a proxy to our package.json within our client folder and have added a .env.development Host name (heroku url)
Root Directory
- client
- package.json
- package-lock.json
- config
- config.json
- passport.json
- controllers
- models
- routes
- .env
- .env.development
- .gitignore
- package-lock.json
- package.json
- server.js
Server package.json
{
"name": "traveler",
"version": "1.0.0",
"homepage": "http://dchicchon.github.io/Traveler",
"description": "A social media platform for people who love traveling and those who want to explore.",
"main": "server.js",
"scripts": {
"start": "if-env NODE_ENV=production && npm run start:prod || npm run start:dev",
"start:prod": "node server.js",
"start:dev": "concurrently \"nodemon --ignore 'client/*'\" \"npm run client\"",
"client": "cd client && npm run start",
"seed": "node scripts/seedDB.js",
"install": "cd client && npm install",
"build": "cd client && npm run build",
"heroku-postbuild": "npm run build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "^2.511.0",
"bcryptjs": "^2.4.3",
"concurrently": "^4.1.1",
"dotenv": "^8.0.0",
"express": "^4.17.1",
"express-session": "^1.16.2",
"gh-pages": "^2.0.1",
"multer": "^1.4.2",
"multer-s3": "^2.9.0",
"mysql2": "^1.6.5",
"passport": "^0.4.0",
"passport-local": "^1.0.0",
"sequelize": "^5.13.1"
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/dchicchon/Traveler.git"
},
"bugs": {
"url": "https://github.com/dchicchon/Traveler/issues"
}
}
Client package.json
{
"name": "traveler",
"version": "0.1.0",
"proxy": "https://travelersite.herokuapp.com/",
"private": true,
"dependencies": {
"axios": "^0.19.0",
"google-map-react": "^1.1.4",
"lodash": "^4.17.15",
"materialize-css": "^1.0.0",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"react-router-dom": "^5.0.1",
"react-scripts": "3.1.0",
"styled-components": "^4.3.2"
},
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^2.1.1"
}
}
After entering the command heroku create and git push heroku master we would expect that our server will be pushed to heroku and our client will be deployed to gh-pages.
Does removing heroku-postbuild script from your backend package.json work?