antonosmond / mock-aws

Mock aws-sdk API methods to enable easier testing of apps which use the AWS SDK for JavaScript
ISC License
14 stars 10 forks source link

AWS-SDK 2.6.1 breaks mock-aws #4

Open yoitsro opened 8 years ago

yoitsro commented 8 years ago

The AWS SDK has changed the way it loads its services. It now employs a lazy loading way, whereby services are loaded when they're first needed: https://github.com/aws/aws-sdk-js/commit/39a1783749c34ba8ef6eb7d1ef1342d309538dff

As a result, this breaks mock-aws.

pedrocarrico commented 8 years ago

@yoitsro Is TypeError: Attempted to wrap undefined property STS as function what you're getting?

Seeing something similar on one of my projects.

yoitsro commented 8 years ago

Hey @pedrocarrico, yeah it is.

hairyhenderson commented 8 years ago

This is happening to me too... 😞

/cc @antonosmond

antonosmond commented 8 years ago

I'll try and look at this at the weekend

hairyhenderson commented 8 years ago

Thanks @antonosmond!

Something really strange I saw last night when digging into this was that if I cloned the repo and npm lned it into my project, I got errors, but not the TypeError. When I npm unlinked the local dep and just npm installed it, I got the TypeError. From what I could tell there were no differences in the module on-disk or from npmjs. There were some differences in sub-dependencies, but I'm not really sure how any of those would've made an impact.

For reference, here's the stack I'm seeing:

TypeError: Attempted to wrap undefined property STS as function
    at checkWrappedMethod (/myrepo/node_modules/sinon/lib/sinon/util/core.js:76:29)
    at Object.wrapMethod (/myrepo/node_modules/sinon/lib/sinon/util/core.js:120:21)
    at Object.stub (/myrepo/node_modules/sinon/lib/sinon/stub.js:60:26)
    at createStub (/myrepo/node_modules/mock-aws/lib/mock-aws.js:17:9)
    at Object.<anonymous> (/myrepo/node_modules/mock-aws/lib/mock-aws.js:12:5)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/myrepo/test/foo_test.js:5:11)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at /Users/dee/.nvm/versions/node/v6.7.0/lib/node_modules/mocha/lib/mocha.js:219:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/dee/.nvm/versions/node/v6.7.0/lib/node_modules/mocha/lib/mocha.js:216:14)
    at Mocha.run (/Users/dee/.nvm/versions/node/v6.7.0/lib/node_modules/mocha/lib/mocha.js:468:10)
    at loadAndRun (/Users/dee/.nvm/versions/node/v6.7.0/lib/node_modules/mocha/bin/_mocha:359:22)
    at Object.<anonymous> (/Users/dee/.nvm/versions/node/v6.7.0/lib/node_modules/mocha/bin/_mocha:376:3)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
antonosmond commented 8 years ago

To be honest I think this is going to need a complete re-write if what @yoitsro said is true. I'll have a look at the weekend and see what I can do.

hairyhenderson commented 8 years ago

😞 - thanks anyway @antonosmond !

hairyhenderson commented 8 years ago

I've noticed that aws-sdk 2.6.4 and above seem to be working fine with mock-aws now... Maybe there's no fix necessary now?

simoneb commented 7 years ago

doesn't seem to work with 2.7.16