[英]Circular structure when getting Google OAuth2 callback on Heroku
I'm using Node v4.4.0, npm 2.14.20 and sails 0.10.5. 我正在使用Node v4.4.0,npm 2.14.20并航行0.10.5。 I've created simple application with Google OAuth2 (all I have is Auth controller with User model and configured passport in config/passport.js) and it's working fine when run locally but fails when deployed on Heroku.
我已经使用Google OAuth2创建了一个简单的应用程序(我所拥有的只是具有用户模型的Auth控制器,并在config / passport.js中配置了护照),并且在本地运行时运行良好,但是在Heroku上部署时运行失败。 From logs I suspect there's a problem creating new session after user is already authenticated by Google.
从日志中,我怀疑在用户已经通过Google身份验证后创建新会话时出现问题。 I've appended a log below, did anybody experience similar problem before?
我在下面附加了日志,以前有人遇到过类似的问题吗?
016-03-16T18:54:01.206409+00:00 heroku[router]: at=info method=GET path="/login" host=porocila-treningov.herokuapp.com request_id=2650d7a4-0047-45b6-bd64-fbe122902c9b fwd="92.53.152.70" dyno=web.1 connect=5ms service=33ms status=200 bytes=1382
2016-03-16T18:54:33.179402+00:00 heroku[router]: at=info method=GET path="/auth/google" host=porocila-treningov.herokuapp.com request_id=e91d0c55-cf6a-4aef-b994-96c3b92bcf9a fwd="92.53.152.70" dyno=web.1 connect=0ms service=9ms status=302 bytes=528
2016-03-16T18:54:35.675271+00:00 app[web.1]: /app/node_modules/sails/node_modules/express/node_modules/connect/lib/middleware/session/memory.js:72
2016-03-16T18:54:35.675281+00:00 app[web.1]: self.sessions[sid] = JSON.stringify(sess);
2016-03-16T18:54:35.675282+00:00 app[web.1]: ^
2016-03-16T18:54:35.675283+00:00 app[web.1]:
2016-03-16T18:54:35.675284+00:00 app[web.1]: at Object.stringify (native)
2016-03-16T18:54:35.675284+00:00 app[web.1]: TypeError: Converting circular structure to JSON
2016-03-16T18:54:35.675286+00:00 app[web.1]: at process._tickDomainCallback (node.js:390:13)
2016-03-16T18:54:35.675285+00:00 app[web.1]: at /app/node_modules/sails/node_modules/express/node_modules/connect/lib/middleware/session/memory.js:72:31
2016-03-16T18:54:35.675286+00:00 app[web.1]: at nextTickCallbackWith0Args (node.js:420:9)
2016-03-16T18:54:35.696055+00:00 app[web.1]:
2016-03-16T18:54:35.706858+00:00 app[web.1]: npm ERR! node v4.4.0
2016-03-16T18:54:35.707355+00:00 app[web.1]: npm ERR! npm v2.14.20
------------SOME MORE CRASH INFO, HOW TO SUBMIT BUG, HOW TO FIND AUTHOR ETC-----------
2016-03-16T18:54:35.669056+00:00 heroku[router]: at=info method=GET path="/auth/google/callback?code=4/-OF3ImicWoSJkNfnoO60C7MNFVUtAj7YG2PXRUQkIUs" host=porocila-treningov.herokuapp.com request_id=a5578684-269c-44a0-abdc-2808517a4ea7 fwd="92.53.152.70" dyno=web.1 connect=0ms service=355ms status=302 bytes=409
2016-03-16T18:54:36.506369+00:00 heroku[web.1]: Process exited with status 1
2016-03-16T18:54:36.518470+00:00 heroku[web.1]: State changed from up to crashed
2016-03-16T18:54:37.792637+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/login" host=porocila-treningov.herokuapp.com request_id=1ab7a2b5-80fb-48b5-993d-ac0f213c996a fwd="92.53.152.70" dyno= connect= service= status=503 bytes=
Circular structure error happens when you any how assign some object to some key for that object. 当您如何将某个对象分配给该对象的某个键时,就会发生圆形结构错误。 for example...
例如...
var obj={
'x':1,
'y':false
};
obj.z=obj;//or anyhow this happens by mistake
so this is ow circular object is formed....and while stringifying such objects cause exception. 因此,这是因为形成了圆形对象。并且在将此类对象字符串化时会导致异常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.