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

Cannot read property 'access-control-allow-origin' of null #5

Closed
jasongrishkoff opened this issue Jan 19, 2017 · 31 comments
Closed

Cannot read property 'access-control-allow-origin' of null #5

jasongrishkoff opened this issue Jan 19, 2017 · 31 comments

Comments

@jasongrishkoff
Copy link

I think this might be related to this issue, but on Galaxy this causes my containers to run out of memory and shut down.

jkqq
2017-01-19 11:08:46+02:00TypeError: Cannot read property 'access-control-allow-origin' of null
jkqq
2017-01-19 11:08:46+02:00 at ServerResponse.res.write (packages/meteorhacks_inject-data.js:108:22)
jkqq
2017-01-19 11:08:46+02:00 at ServerResponse.OutgoingMessage.end (_http_outgoing.js:588:10)
jkqq
2017-01-19 11:08:46+02:00 at /app/bundle/programs/server/npm/node_modules/meteor/dferber_prerender/node_modules/prerender-node/index.js:29:20
jkqq
2017-01-19 11:08:46+02:00 at Gunzip.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/dferber_prerender/node_modules/prerender-node/index.js:201:5)
jkqq
2017-01-19 11:08:46+02:00 at emitNone (events.js:72:20)
jkqq
2017-01-19 11:08:46+02:00 at Gunzip.emit (events.js:166:7)
jkqq
2017-01-19 11:08:46+02:00 at endReadableNT (_stream_readable.js:923:12)
jkqq
2017-01-19 11:08:46+02:00 at nextTickCallbackWith2Args (node.js:458:9)
jkqq
2017-01-19 11:08:46+02:00 at process._tickDomainCallback (node.js:413:17)
@jamiedumont
Copy link

I've been experiencing this issue too. I contacted Galaxy support about the issue when I first encountered it (October I believe). Apparently this package was being updated later that week as dferber:prerender a had fallen behind. I haven't tried the package since though.

@jamiedumont
Copy link

Just tried this again, and I can confirm that I get the same error when deploying to my live site (using 3 x 1gb containers). However, deploying to my staging site (using 1 x 512mb) container doesn't cause the error. I don't think it's memory related

@jamiedumont
Copy link

After doing some more testing, it looks like the issue is located within the dferber:prerender package, or at least an interaction between that and meteorhacks:inject-data as you identified

@jamiedumont
Copy link

I can confirm that the issue lies with the meteorhacks:inject-data package being used by kadirahq:flow-router-ssr in Meteor versions 1.4.2+. There are alternative packages that have been updated since Kadira's abandonment of their packages (staringatlights:inject-data for example). Replacing FlowRouters dependency on inject-data with this alternative package appears to have worked for me.

I'm now using staringatlights:inject-data, staringatlights:fast-render and bensventures:flow-router-ssr and all is working well.

Leaving this here, and open, so that others who have run into this issue can see my solution.

@jasongrishkoff
Copy link
Author

jasongrishkoff commented Jan 31, 2017 via email

@glasser
Copy link
Contributor

glasser commented Feb 14, 2017

What versions of meteor:seo/dferber:prerender are you using if you're seeing this? (Check the .meteor/versions file for versions.) Note that there's a difference between dferber:prerender and dfischer:prerenderio: dferber is the newer one and I thought it fixed this issue.

@ldelaporte
Copy link

ldelaporte commented Feb 14, 2017

Thanks for the quick reply - dferber:prerender@2.2.2_3. Switching to bensventures:flow-router-ssr seemed to work for a bit, but I have the same issue again now

@berkaytheunicorn
Copy link

same issue here!

mdg:seo

@etheleon
Copy link

etheleon commented Mar 1, 2017

having the same issue using mdg:seo

@vedovato
Copy link

vedovato commented Mar 2, 2017

Same here

@davidalekna
Copy link

same here!

1 similar comment
@jirikrepl
Copy link
Contributor

same here!

@krishaamer
Copy link

krishaamer commented Mar 23, 2017

We're paying Galaxy customers and out-of-the-box SEO is a feature that's marketed by Galaxy. This should be fixed asap!

@jasongrishkoff
Copy link
Author

@jamiedumont's solution does work, but I have to agree with @krishaamer -- Galaxy is telling us to use this package and it's definitely not working.

@glasser
Copy link
Contributor

glasser commented Mar 23, 2017

Can somebody provide a reproduction recipe showing how to reproduce this issue? That will make it much easier to debug.

@vedovato
Copy link

Just upload an app with the package to galaxy (cause we have logs) and check it after 20 min more or less

@glasser
Copy link
Contributor

glasser commented Mar 23, 2017

This is an issue about subtle interactions between multiple packages all of which change over time. I spent a while working on this in the past and thought I fixed it but apparently not for everyone. That is why detailed bug reports help.

@abernix
Copy link

abernix commented Mar 24, 2017

@vedovato It's not clear to me if this is how you've reproduced this problem yourself or merely a suggestion but I attempted to reproduce the problem (with your directions) and despite my best attempts, which included waiting long periods of times (much longer than 20 minutes) and throwing a lot of requests at my container, I could not reproduce this problem.

I am going to attempt to reproduce using meteorhacks:inject-data and I will report back. As previously requested, if anyone has any specific suggestions or known reproduction steps, please let me know!

@vedovato
Copy link

Hey @abernix, that's what i'm getting after just insert mdg:seo package. Is this related to this package? Reading now it seems a bit non-related....

schermata 2017-03-24 alle 14 34 37

@abernix
Copy link

abernix commented Mar 24, 2017

@vedovato What you're showing further demonstrates the problem @glasser is suggesting: an incompatibility with some other package and mdg:seo, when both are installed together. I am confident that mdg:seo works by itself from my testing, so there is another factor we must consider.

Can you possibly provide a Gist link to the contents of your .meteor/packages and .meteor/versions file? While it's just a list of packages, if you're not comfortable sharing it publically, you can private message it to me on the Meteor forums (same username as here).

@vedovato
Copy link

Oh, i understand @abernix. I'm not in position to test it by myself now but here goes what you requested: https://gist.github.com/vedovato/714de90c5c2eb55cc2a9d4d9550a18fe. Thank you!

@abernix
Copy link

abernix commented Mar 27, 2017

@vedovato The problem you're experiencing seems directly related to the problem that @jamiedumont referred to above in this comment.

There is absolutely a bug with the meteorhacks:inject-data package (not a part of mdg:seo or dferber:prerender) which will cause the exact error that you're experiencing with the access-control-allow-origin message.

The fix for using that package with Meteor 1.4.2 is included in this commit (which is part of the staringatlights:inject-data package). You may be able to simply add the staringatlights:inject-data package to your project (early up in your packages list), thanks to this commit which forces the package to take over the meteorhacks:inject-data method.

Could you play around and see if that fixes it for you? Without you taking action to update the inject-data package's deficiency, I'm fairly sure that only way to fix this would be to "hack the hack".

@vedovato
Copy link

Ok, @abernix. Thanks a lot for getting around this for me (also @jamiedumont)! I'll definitely try it and deploy to see if it solves. Will feedback you here today, later.

@vedovato
Copy link

vedovato commented Mar 27, 2017

Hey @abernix, it's confirmed! The aringatlights:inject-data package listed early up in package.json has solved this issue. Thank you!

@davidalekna
Copy link

Hey guys it didint solve my error, as I noticed your discussion above about adding 2 packages:

staringatlights:inject-data
mdg:seo

I still get following error on galaxy server:

dfc3
2017-03-28 09:14:38+01:00packages/meteorhacks_inject-data.js:108
dfc3
2017-03-28 09:14:38+01:00 if(res._headers['access-control-allow-origin']) {
dfc3
2017-03-28 09:14:38+01:00 ^
dfc3
2017-03-28 09:14:38+01:00
dfc3
2017-03-28 09:14:38+01:00TypeError: Cannot read property 'access-control-allow-origin' of null
dfc3
2017-03-28 09:14:38+01:00 at ServerResponse.res.write (packages/meteorhacks_inject-data.js:108:22)
dfc3
2017-03-28 09:14:38+01:00 at ServerResponse.OutgoingMessage.end (_http_outgoing.js:600:10)
dfc3
2017-03-28 09:14:38+01:00 at /app/bundle/programs/server/npm/node_modules/meteor/dferber_prerender/node_modules/prerender-node/index.js:29:20
dfc3
2017-03-28 09:14:38+01:00 at Gunzip.<anonymous> (/app/bundle/programs/server/npm/node_modules/meteor/dferber_prerender/node_modules/prerender-node/index.js:201:5)
dfc3
2017-03-28 09:14:38+01:00 at emitNone (events.js:72:20)
dfc3
2017-03-28 09:14:38+01:00 at Gunzip.emit (events.js:166:7)
dfc3
2017-03-28 09:14:38+01:00 at endReadableNT (_stream_readable.js:923:12)
dfc3
2017-03-28 09:14:38+01:00 at nextTickCallbackWith2Args (node.js:511:9)
dfc3
2017-03-28 09:14:38+01:00 at process._tickCallback (node.js:425:17)

@vedovato
Copy link

@davidalekna Did you insert the staringatlights:inject-data right after meteor default packages and before mdg:seo one? This may lead to the solution, i think. Please try it

@davidalekna
Copy link

nope, I added it right at the end... just deploying with new changes now and will confirm in a bit

@davidalekna
Copy link

awesome, works like a charm! Cheers!

@jamiedumont
Copy link

Just to confirm, so that everyone is clear, as @glasser said, this is a result of the interaction between lots of different packages - it's just unfortunate that it's such a common one, and that many other popular ones (FlowRouter) depend on it.

The solution is to replace the meteorhacks:inject-data package with the staringatlights:inject-data package. Any other packages that depend of the meteorhacks package will either have to have it's dependancies changed, or a variant with the dependancies already modified (such as bensventures:flow-router-ssr)

Not my repo, but I'd suggest this gets closed, and perhaps some of this info is added to the docs either on the seo package, or in the Galaxy docs itself.

@epeng5
Copy link

epeng5 commented Apr 21, 2017

I ran into this issue with meteorhacks:fast-render depending on meteorhacks:inject-data, which was mentioned here: meteorhacks/inject-data#10.

Switching from meteorhacks:fast-render to flean:fast-render fixed the issue.

@filipenevola
Copy link
Contributor

I don't think this issue is still happening.

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