Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This package is randomly causing my servers to crash and restart #10

Open
elie222 opened this issue Nov 6, 2016 · 13 comments
Open

This package is randomly causing my servers to crash and restart #10

elie222 opened this issue Nov 6, 2016 · 13 comments

Comments

@elie222
Copy link

elie222 commented Nov 6, 2016

This is the error I see in my logs:

uncaughtException: Cannot read property 'access-control-allow-origin' of null 
    { date: 'Sun Nov 06 2016 05:06:24 GMT+0000 (UTC)', 
      process:  
       { pid: 139, 
         uid: 0, 
         gid: 0, 
         cwd: '/bundle/bundle/programs/server', 
         execPath: '/opt/nodejs/bin/node', 
         version: 'v4.4.7', 
         argv:  
          [ '/opt/nodejs/bin/node', 
            '/bundle/bundle/main.js', 
            'program.json' ], 
         memoryUsage: { rss: 383619072, heapTotal: 330623328, heapUsed: 299786400 } }, 
      os:  
       { loadavg: [ 0.2236328125, 0.0810546875, 0.11279296875 ], 
         uptime: 2327807 }, 
      trace:  
       [ { column: 22, 
           file: 'packages/meteorhacks_inject-data.js', 
           function: 'ServerResponse.res.write', 
           line: 108, 
           method: 'res.write', 
           native: false }, 
         { column: 10, 
           file: '_http_outgoing.js', 
           function: 'ServerResponse.OutgoingMessage.end', 
           line: 588, 
           method: 'OutgoingMessage.end', 
           native: false }, 
         { column: 20, 
           file: '/bundle/bundle/programs/server/npm/node_modules/prerender-node/index.js', 
           function: null, 
           line: 29, 
           method: null, 
           native: false }, 
         { column: 5, 
           file: '/bundle/bundle/programs/server/npm/node_modules/prerender-node/index.js', 
           function: '', 
           line: 210, 
           method: null, 
           native: false }, 
         { column: 20, 
           file: 'events.js', 
           function: 'emitNone', 
           line: 72, 
           method: null, 
           native: false }, 
         { column: 7, 
           file: 'events.js', 
           function: 'Gunzip.emit', 
           line: 166, 
           method: 'emit', 
           native: false }, 
         { column: 12, 
           file: '_stream_readable.js', 
           function: 'endReadableNT', 
           line: 921, 
           method: null, 
           native: false }, 
         { column: 9, 
           file: 'node.js', 
           function: 'nextTickCallbackWith2Args', 
           line: 442, 
           method: null, 
           native: false }, 
         { column: 17, 
           file: 'node.js', 
           function: 'process._tickCallback', 
           line: 356, 
           method: '_tickCallback', 
           native: false } ], 
      stack:  
       [ 'TypeError: Cannot read property \'access-control-allow-origin\' of null', 
         '    at ServerResponse.res.write (packages/meteorhacks_inject-data.js:108:22)', 
         '    at ServerResponse.OutgoingMessage.end (_http_outgoing.js:588:10)', 
         '    at /bundle/bundle/programs/server/npm/node_modules/prerender-node/index.js:29:20', 
         '    at Gunzip.<anonymous> (/bundle/bundle/programs/server/npm/node_modules/prerender-node/index.js:210:5)', 
         '    at emitNone (events.js:72:20)', 
         '    at Gunzip.emit (events.js:166:7)', 
         '    at endReadableNT (_stream_readable.js:921:12)', 
         '    at nextTickCallbackWith2Args (node.js:442:9)', 
         '    at process._tickCallback (node.js:356:17)' ] } 
@elie222
Copy link
Author

elie222 commented Nov 6, 2016

This is the problematic line:
https://github.com/meteorhacks/inject-data/blob/master/lib/server.js#L41

if(res._headers['access-control-allow-origin']) {

res._headers is sometimes undefined. Any ideas how this could happen?
I'm going to keep investigating.

@elie222
Copy link
Author

elie222 commented Nov 6, 2016

Well looks like its conflicting with prerender-node which I recently updated.

@RobinVanCauter
Copy link

@elie222 I'm having the exact same issue. Have you found a solution yet?

@elie222
Copy link
Author

elie222 commented Nov 18, 2016

I think I forked it and changed the line where the error was happening.

You need to check if one of the variables is null to stop the exception
from being thrown.

I'll have a look at my code tomorrow. It was a tiny change.

On 18 Nov 2016 12:00 a.m., "Robin Van Cauter" [email protected]
wrote:

@elie222 https://github.com/elie222 I'm having the exact same issue.
Have you found a solution yet?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC8oX-LNYJT_bdd0UCHo3NFbeCF8HYRKks5q_XdHgaJpZM4KqfqW
.

@elie222
Copy link
Author

elie222 commented Nov 18, 2016

And I think it happened with prerender integration.

On 18 Nov 2016 12:02 a.m., "Eliezer Steinbock"
wrote:

I think I forked it and changed the line where the error was happening.

You need to check if one of the variables is null to stop the exception
from being thrown.

I'll have a look at my code tomorrow. It was a tiny change.

On 18 Nov 2016 12:00 a.m., "Robin Van Cauter" [email protected]
wrote:

@elie222 https://github.com/elie222 I'm having the exact same issue.
Have you found a solution yet?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#10 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC8oX-LNYJT_bdd0UCHo3NFbeCF8HYRKks5q_XdHgaJpZM4KqfqW
.

@flean
Copy link

flean commented Nov 30, 2016

Any updates? Did your fix work? I'm having the same issues.

@elie222
Copy link
Author

elie222 commented Nov 30, 2016 via email

@glasser
Copy link

glasser commented Dec 21, 2016

Try using it with dferber:prerender instead of dfischer:prerenderio? They have the same interface but dferber's uses a newer version of the underlying NPM module which doesn't require the majority of the code in from the old package.

@flean
Copy link

flean commented Dec 21, 2016

That doesn't work, I've made my own fix. use flean:fast-render and it will load flean:inject-data that has the patch.

@glasser
Copy link

glasser commented Dec 21, 2016

@flean I haven't actually been able to reproduce the crashes in order to test if different versions work or not. Can you show me how to reproduce the crash?

@jpadvo
Copy link

jpadvo commented Feb 13, 2017

We are having this issue in production, and have switched over to using flean:fast-render to fix it. In production it appears to happen randomly, so we don't know how to repro. Hopefully this fix can get merged in some time. : )

@krishaamer
Copy link

It's still happening. Any plans to fix the Meteorhacks package?

gnjw 2017-03-23 09:00:22+02:00packages/meteorhacks_inject-data.js:108 gnjw 2017-03-23 09:00:22+02:00 if(res._headers['access-control-allow-origin']) { gnjw 2017-03-23 09:00:22+02:00 ^ gnjw 2017-03-23 09:00:22+02:00 gnjw 2017-03-23 09:00:22+02:00TypeError: Cannot read property 'access-control-allow-origin' of null gnjw 2017-03-23 09:00:22+02:00 at ServerResponse.res.write (packages/meteorhacks_inject-data.js:108:22) gnjw 2017-03-23 09:00:22+02:00 at ServerResponse.OutgoingMessage.end (_http_outgoing.js:600:10) gnjw 2017-03-23 09:00:22+02:00 at /app/bundle/programs/server/npm/node_modules/meteor/dferber_prerender/node_modules/prerender-node/index.js:29:20 gnjw 2017-03-23 09:00:22+02:00 at Gunzip.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/dferber_prerender/node_modules/prerender-node/index.js:201:5) gnjw 2017-03-23 09:00:22+02:00 at emitNone (events.js:72:20) gnjw 2017-03-23 09:00:22+02:00 at Gunzip.emit (events.js:166:7) gnjw 2017-03-23 09:00:22+02:00 at endReadableNT (_stream_readable.js:923:12) gnjw 2017-03-23 09:00:22+02:00 at nextTickCallbackWith2Args (node.js:511:9) gnjw 2017-03-23 09:00:22+02:00 at process._tickCallback (node.js:425:17) gnjw 2017-03-23 09:00:22+02:00Application exited with code: 1 gnjw 2017-03-23 09:00:25+02:00The container has crashed. A new container will be started to replace it.

@cosmin-novac
Copy link

Anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants