Giter VIP home page Giter VIP logo

blogful-api's Introduction

Blogful API

Sequence

  1. Databases with Express https://courses.thinkful.com/node-postgres-v1/checkpoint/15
  2. POST and DELETE with PostgreSQL https://courses.thinkful.com/node-postgres-v1/checkpoint/16
  3. PATCH (and RESTful API) https://courses.thinkful.com/node-postgres-v1/checkpoint/17
  4. Add Relationships https://courses.thinkful.com/node-postgres-v1/checkpoint/19
  5. Deploying Database (on Heroku) https://courses.thinkful.com/node-postgres-v1/checkpoint/20

CRUCIAL UPDATE! commit

Despite carefully following instructions for deploying database per https://courses.thinkful.com/node-postgres-v1/checkpoint/20 ... I reached an impasse at the stage of trying to run migrations on the heroku-postresql.

$ npm run migrate:production kept failing at the blogful-api migrate script =/

The error in full...

➜  blogful-api git:(master) npm run migrate:production
Running npm run migrate on ⬢ shielded-woodland-48221... up, run.9816 (Free)

> [email protected] migrate /app
> postgrator --config postgrator-config.js

sh: 1: postgrator: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] migrate: `postgrator --config postgrator-config.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] migrate 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!     /app/.npm/_logs/2020-08-02T22_21_05_392Z-debug.log
➜  blogful-api git:(master)

Thanks to a long troubleshooting session with Jonathan Huxhold @ ThinkfulChat, the issue ws eventually resolved with the following alterations below...

Alterations

1) packgage.json "scripts"

  • Originally: "migrate:production": "heroku run npm run migrate"

  • Update, per ThinkChat suggestion: "migrate:production": "env SSL=true NODE_TLS_REJECT_UNAUTHORIZED=0 DATABASE_URL=$(heroku config:get DATABASE_URL) npm run migrate"

  • I subsequently tried to revert back to the original after initial migration done but migrate:production failed again, so returning to the convoluted command with SSL.

2) postgrator-config.js

  • Add "ssl": !!process.env.SSL to the module.export properties.

Jonathan said, "I think postgrator does something under the hood to accommodate ssl settings on db up in the environment. The double bang (!!) casts a truthy or falsy value to a boolean true or false. So by adding it as an actual postgrator config value, it was able to establish the connection."

blogful-api's People

Contributors

artificialarea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.