简体   繁体   English

在Heroku上获取Google OAuth2回调时的循环结构

[英]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

see the screenshot!!! 看截图!!!

so this is ow circular object is formed....and while stringifying such objects cause exception. 因此,这是因为形成了圆形对象。并且在将此类对象字符串化时会导致异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Google OAuth2 和 Passportjs 重定向到回调 url 时出现 500 内部服务器错误 - Getting a 500 Internal server error when redirecting to the callback url using google OAuth2 with Passportjs 使用 Google OAuth2 将 Node.js 应用程序部署到 Heroku 时出现 redirect_uri_mismatch - I'm getting a redirect_uri_mismatch when deploying my Node.js app to Heroku using Google OAuth2 在 Heroku 上实时部署时,passport google oauth2 会导致“内部服务器错误” - passport google oauth2 causes “internal server error” when deployed live on Heroku NodeJS google Oauth2 完美运行,但部署到 Heroku 会阻止 google Oauth2 运行 [已解决] - NodeJS google Oauth2 works perfectly, but deployment to Heroku stops google Oauth2 from working [SOLVED] Passportjs的Google OAuth2回调引发无法访问此网站的错误 - PassportJs Google OAuth2 callback throws this site cant be reached error 使用 Firebase 函数的 Google oAuth2 回调问题 - Issue with Google oAuth2 callback using Firebase functions OAuth2回调-识别用户? - OAuth2 callback - identify user? 部署到 Heroku 时无法使用 Google OAuth 登录 - Unable to login with Google OAuth when deployed to Heroku 在 nodejs 中调用 getToken 时 Google OAuth2 客户端超时 - Google OAuth2 client timeout when calling getToken in nodejs 尝试使用 Passport 设置 Google OAuth2 时“id”无效 - Invalid "id" when trying to set up Google OAuth2 with Passport
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM