bartonhammond/snowflake

Hapi server not working when register an account.

Closed this issue · 2 comments

I'm using https://github.com/bartonhammond/snowflake-hapi-openshift to run backend for snowflake locally.

The hapi server config:

module.exports = {
  mongodb: {
    ip: '127.0.0.1',
    port: '27017',
    app: 'nodejs'
  },
  redis: {
    host: '127.0.0.1',
    port: 6379
  },  
  crypto: {
    privateKey:
    '37LvDSasdfasfsaf3a3IEIA;3r3oi3joijpjfa3a3m4XvjYOh9Yaa.p3id#IEYDNeaken',
    tokenExpiry: 1 * 30 * 1000 * 60 //1 hour
  },
  email: {
    test: true,    
    username: "notice@mg.zaiqiuchang.com",
    password: "XXXXX",
    accountName: "Snowflake"
  },
  validation: {
    username: /^[a-zA-Z0-9]{6,12}$/,
    password: /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,12}$/
  }
};

The server log:

➜  snowflake-hapi-openshift git:(master) ✗ npm start

> showflake-hapi-openshift@0.0.1 start /Users/jagger/projects/snowflake-hapi-openshift
> cp ./README.md src/docs && node server.js

Server is running: http://jagger-mbp:5000
registerUser { username: 'jaggerwang',
  email: 'jaggerwang@gmail.com',
  password: 'XXXXX' }
160720/095804.896, [response], http://jagger-mbp:5000: post /account/register {} 409 (70ms)

And app get following error:
image

I am not able to replicate this. It works fine for me. Perhaps you could debug and log what the response actually is?

This is working w/ the latest release https://github.com/bartonhammond/snowflake/releases/tag/0.1.2-alpha.

It had to do w/ the src/lib/Hapi.js which has been updated to use response.json() so take a look there if you are interested.

Be sure to read those release notes!