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

Stripe errors in spiderable package #3

Open
BradRyan opened this issue Jul 7, 2015 · 11 comments
Open

Stripe errors in spiderable package #3

BradRyan opened this issue Jul 7, 2015 · 11 comments

Comments

@BradRyan
Copy link

BradRyan commented Jul 7, 2015

I've been having spiderable issues when testing the '?escaped_fragment=' (similar to those here: iron-meteor/iron-router#1192) while hosting on Modulus. I was attempting to fix them by using ongoworks:spiderable package. The error I was getting on the server is resolved, but now I'm seeing some other strange issues.

Using the ongoworks:spiderable package on the server, the following shows up inside my browser window's tags. I'm concerned this might actually show up in crawler results as I can see it on my browser window.

ReferenceError: Can't find variable: Stripe

  http://localhost:8080/6be5bf8c35549ee74d21715c535054213bed89d5.js:318
  http://localhost:8080/6be5bf8c35549ee74d21715c535054213bed89d5.js:3
  http://localhost:8080/6be5bf8c35549ee74d21715c535054213bed89d5.js:3

Using the ongoworks:spiderable package on localhost (http://localhost:3000/?_escaped_fragment_=) I get the following errors in my browser console.

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://localhost:20677') does not match the recipient window's origin ('http://localhost:3000').Stripe.isDoubleLoaded.H.stack.PostMessageTransport.g.onDOMReady @ (index):2(anonymous function) @ (index):2i @ (index):2

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://localhost:20677') does not match the recipient window's origin ('http://localhost:3000').window.onload @ channel.html?stripe_xdm_e=http%3A%2F%2Flocalhost%3A20677&stripe_xdm_c=default890866&stripe_xdm_p=1:25

Any ideas?

@BradRyan
Copy link
Author

BradRyan commented Jul 7, 2015

FYI, the errors when using the packages dfischer:phantomjs and spiderable I don't get any errors locally, but when running on the server I am seeing the following error when including the escaped fragment.

spiderable: phantomjs failed: { [Error: Command failed: Can't open '/dev/stdin'
] killed: false, code: 255, signal: null } 
stderr: Can't open '/dev/stdin'

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
    at Object.Meteor._nodeCodeMustBeInFiber (packages/meteor/dynamics_nodejs.js:9:1)
    at [object Object]._.extend.get (packages/meteor/dynamics_nodejs.js:21:1)
    at [object Object].RouteController.lookupOption (packages/iron:router/lib/route_controller.js:66:1)
    at new Controller.extend.constructor (packages/iron:router/lib/route_controller.js:26:1)
    at [object Object].ctor (packages/iron:core/lib/iron_core.js:88:1)
    at Function.Router.createController (packages/iron:router/lib/router.js:201:1)
    at Function.Router.dispatch (packages/iron:router/lib/router_server.js:39:1)
    at Object.router (packages/iron:router/lib/router.js:15:1)
    at next (/mnt/app/node_modules/connect/lib/proto.js:190:15)
    at packages/spiderable/spiderable_server.js:123:1
    at ChildProcess.exithandler (child_process.js:652:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Found package.json: ./package.json
Start script specified in package.json: node main.js
Initializing Node.js 0.10.33
Now using node v0.10.33
Running command: npm start

@benjick
Copy link
Owner

benjick commented Jul 13, 2015

How are you using the package?

On Tue, Jul 7, 2015 at 11:36 PM, BradRyan notifications@github.com wrote:

FYI, the errors when using the packages dfischer:phantomjs and spiderable
I don't get any errors locally, but when running on the server I am seeing
the following error when including the escaped fragment.

spiderable: phantomjs failed: { [Error: Command failed: Can't open '/dev/stdin'
] killed: false, code: 255, signal: null }
stderr: Can't open '/dev/stdin'

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
at Object.Meteor.nodeCodeMustBeInFiber (packages/meteor/dynamics_nodejs.js:9:1)
at [object Object].
.extend.get (packages/meteor/dynamics_nodejs.js:21:1)
at [object Object].RouteController.lookupOption (packages/iron:router/lib/route_controller.js:66:1)
at new Controller.extend.constructor (packages/iron:router/lib/route_controller.js:26:1)
at [object Object].ctor (packages/iron:core/lib/iron_core.js:88:1)
at Function.Router.createController (packages/iron:router/lib/router.js:201:1)
at Function.Router.dispatch (packages/iron:router/lib/router_server.js:39:1)
at Object.router (packages/iron:router/lib/router.js:15:1)
at next (/mnt/app/node_modules/connect/lib/proto.js:190:15)
at packages/spiderable/spiderable_server.js:123:1
at ChildProcess.exithandler (child_process.js:652:7)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Found package.json: ./package.json
Start script specified in package.json: node main.js
Initializing Node.js 0.10.33
Now using node v0.10.33
Running command: npm start


Reply to this email directly or view it on GitHub
#3 (comment)
.

@BradRyan
Copy link
Author

The stripe package? At the time the error is thrown I'm not using it at all. It's just being loaded with the recommended startup code. In my app, I'm using Stripe Connect, and other miscellaneous charge / refund features. Note that I don't normally get this error, but when I type in ''www.mywebsite.com?escaped_fragment='', the error appears.

This didn't occur with the regular spiderable package, but the server threw exceptions that would allow the web spiders to crawl my site.

@benjick
Copy link
Owner

benjick commented Jul 14, 2015

So you're not using the package?

Could you do if(typeof(Stripe) !== 'undefined') { Stripe.set.... }?

@BradRyan
Copy link
Author

Thanks for the suggestion... Where would you recommend I place that code exactly?

@BradRyan
Copy link
Author

nevermind... I get it!

@BradRyan
Copy link
Author

I get the same error that I had previously on the local machine. I don't think the startup code is run when using ?escaped_fragment=. I put a log in front of the setPublishable key and I'm not seeing it. Perhaps because it's not initalized it throws the error becouse of stripe functions on the server?

This error is strange though:

Stripe.isDoubleLoaded.H.stack.PostMessageTransport.g.onDOMReady

@benjick
Copy link
Owner

benjick commented Jul 14, 2015

Strange, are you doing setPublishableKey on client only or both?

@BradRyan
Copy link
Author

I've been setting it in the client only.

@adamwong246
Copy link

+1

@BradRyan
Copy link
Author

BradRyan commented Oct 9, 2015

@adamwong246 FYI, I ended up pulling this out of my client code and just establishing the key on my calls. Definitely messed up my SEO for a bit.

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

3 participants