Skip to content

Commit

Permalink
Don't require() a file that was path.join()ed.
Browse files Browse the repository at this point in the history
This commit fixes an issue where the SDK would not correctly
load with `require("aws-sdk")` on a Windows machine running Node.js
0.11.x. This error is caused by the following two behavioral changes
in Node.js:

* nodejs/node-v0.x-archive#6829
* nodejs/node-v0.x-archive#7031

In essence, Node.js `require()` calls return different objects for
differently cased filenames, even on case-insensitive file systems.
This, coupled with the fact that `path.join()` lowercases the drive
letter in the path, causes the SDK to try to load core.js two
separate times, creating two objects that do not have the
correct properties attached.

See #303 for more information.
  • Loading branch information
lsegal committed Jun 19, 2014
1 parent 408a438 commit 814e967
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ apis.services.forEach(function(identifier) {

// load any customizations from lib/services/<svcidentifier>.js
var svcFile = path.join(__dirname, 'services', identifier + '.js');
if (fs.existsSync(svcFile)) require(svcFile);
if (fs.existsSync(svcFile)) require('./services/' + identifier);
});

0 comments on commit 814e967

Please sign in to comment.