mikenorthorp / gulp-shopify-upload

gulp plugin to watch and upload files to Shopify for use in theme editing
Other
40 stars 22 forks source link

Object has no method #13

Closed Jonjoe closed 9 years ago

Jonjoe commented 9 years ago
/home/miles/Code/nrgit-shop/node_modules/gulp-shopify-upload/index.js:156
            shopify.oFileUploaded();
                    ^
TypeError: Object #<Object> has no method 'oFileUploaded'
  at onUpdate (/home/miles/Code/nrgit-shop/node_modules/gulp-shopify-upload/index.js:156:21)
  at [object Object]._onTimeout (/home/miles/Code/nrgit-shop/node_modules/gulp-shopify-upload/node_modules/shopify-api/lib/resource.js:43:30)
  at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Looks like .oFileUploaded() is not being declared properly

mikenorthorp commented 9 years ago

I'll contact the guy who did made that pull request to see if he can fix it! I'm just super busy at the moment haha.

seanchenca commented 9 years ago

I think the problem is that oFileUploaded is defined in function shopify._setOptions(), but if you don't supply the options parameter to the gulpShopify() call, shopify._setOptions probably never get called, hence oFileUploaded is undefined. Just change the call to gulpShopfiy() (in gulpfile.js) to something like this and it should fix the problem (the empty object being the options parameter):

gulpShopify('API_KEY', 'PASSWORD', 'SHOP.myshopify.com', null, {})

joeldrapper commented 9 years ago

@mikenorthorp thank you!

We're using your plugin as part of our build script for a big ecommerce project and this change broke the workflow for anyone who npm-installed after it was updated. It would be great if the NPM module would stick to the verion number that's specified in our package.json See #12

levymetal commented 9 years ago

I'm a little bit confused as to what oFileUploaded actually is. After a successful upload, this line is called: shopify.oFileUploaded(). Taking a look at the options, we get this: shopify.oFileUploaded = (options.hasOwnProperty("oFileUploaded") && options.oFileUploaded) || (function () {return undefined; }). The first conditional sets oFileUploaded to true if the property is set and equates to true. This is already a problem, because it would break the above line of code that tries to call oFileUploaded as a function. However, this never happens, and as a result, shopify.oFileUploaded always returns a function that does nothing. I really don't understand why this is here at all, unless I'm missing something? I've removed all of this and it still works fine, so I'll submit a PR.

mikenorthorp commented 9 years ago

Yea that sounds good, it was someone elses PR that made the initial change. And Joel, can't you just specify the version number in your package.json to not use the latest?

On Thu, Aug 13, 2015 at 11:45 PM, Christian Varga notifications@github.com wrote:

I'm a little bit confused as to what oFileUploaded actually is. After a successful upload, this line is called: shopify.oFileUploaded(). Taking a look at the options, we get this: shopify.oFileUploaded = (options.hasOwnProperty("oFileUploaded") && options.oFileUploaded) || (function () {return undefined; }). The first conditional sets oFileUploaded to true if the property is set and equates to true. This is already a problem, because it would break the above line of code that tries to call oFileUploaded as a function. However, this never happens, and as a result, shopify.oFileUploaded always returns a function that does nothing. I really don't understand why this is here at all, unless I'm missing something? I've removed all of this and it still works fine, so I'll submit a PR.

— Reply to this email directly or view it on GitHub https://github.com/mikenorthorp/gulp-shopify-upload/issues/13#issuecomment-130933643 .

mikenorthorp commented 9 years ago

Im going to make the issues a priority to fix tomorrow morning since I'll have some free time then.

On Fri, Aug 14, 2015 at 12:02 AM, Michael Northorp mike.northorp@gmail.com wrote:

Yea that sounds good, it was someone elses PR that made the initial change. And Joel, can't you just specify the version number in your package.json to not use the latest?

On Thu, Aug 13, 2015 at 11:45 PM, Christian Varga < notifications@github.com> wrote:

I'm a little bit confused as to what oFileUploaded actually is. After a successful upload, this line is called: shopify.oFileUploaded(). Taking a look at the options, we get this: shopify.oFileUploaded = (options.hasOwnProperty("oFileUploaded") && options.oFileUploaded) || (function () {return undefined; }). The first conditional sets oFileUploaded to true if the property is set and equates to true. This is already a problem, because it would break the above line of code that tries to call oFileUploaded as a function. However, this never happens, and as a result, shopify.oFileUploaded always returns a function that does nothing. I really don't understand why this is here at all, unless I'm missing something? I've removed all of this and it still works fine, so I'll submit a PR.

— Reply to this email directly or view it on GitHub https://github.com/mikenorthorp/gulp-shopify-upload/issues/13#issuecomment-130933643 .

mikenorthorp commented 9 years ago

Fixed this issue, holding off on future PR's for now as well until I have time to review them.