-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 'prototype' of undefined in dynamodb.js #303
Comments
I'm thinking this may be the byproduct of an s3 authentication user error. |
I'd be curious as to what you mean by an S3 authentication error. If you can provide code that reproduces it, that would be great-- I cannot seem to produce this issue with a regular npm install and a |
I should add that I have seen this error before, but only when the aws-sdk-apis package is malfunctioning (which 3.0.2 should not be). Basically what (should) happen is this:
The services.js file is required when the SDK is loaded. The problem here is likely that AWS.Service.defineService('dynamodb', '...'); is returning This should never happen, of course, since the DynamoDB model is correctly defined in aws-sdk-apis. It's possible that there's some Windows specific issue here, because we are reading a directory using the fs module, and that may be returning different things on Windows. That said, I just tested installing the SDK on a Windows machine and was able to load it. |
Actually -- it looks like this is a Windows specific issue, specifically with Node 0.11.x. I could not originally reproduce this because I was using the latest stable release of Node.js, 0.10.29. It looks like there seems to be some kind of regression in Node.js 0.11.x on Windows. I would recommend opening an issue for this against the Node.js project. Is there a reason you are using 0.11.x? The 0.11.x branch is not considered a stable release of Node, and you should only be using the stable releases for production code. The node.js homepage currently lists v0.10.29 as the latest release. I would recommend using that as a workaround. |
Thanks for the feedback. I also cannot replicate locally on a windows VM, nor on OS X. The only place I'm seeing this on appeveyor. Your comment just came in: Right, I'm using node v0.11.x for a very specific reason, which is that log output does not work on appveyor until node v0.11.x. (details on why at mapnik/node-mapnik#257 (comment)). I'm trying to debug what is likely a normal issue using aws-sdk to put data to s3 but because I can't see any errors with node v0.10.x I moved to testing just with node v0.11.x. So, its totally possible this error is also only happening for me on v0.11.x, but I can't know for sure its not occuring on v0.10.x due to the log output not showing up with earlier node.js versions. |
Looks like for some weird reason |
So I did some digging through recent reported issues and managed to narrow down this issue to two related changes in Node.js 0.11.x that other users have reported as bugs:
These two issues are related, but ultimately it's nodejs/node-v0.x-archive#7031 that actually causes the bug in loading the SDK. Basically, Node.js's My guess is the reason that Presumably this should fix itself once Node.js resolves these two related issues, but until then it is a trivial fix to work around this in the SDK. I will have a commit that fixes loading of the SDK in Windows using Node.js 0.11.x shortly. |
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.
@springmeyer if you want to point your aws-sdk dependency at the above commit in our git repository, that should get you going to continue debugging your code against Appveyor. I know that this is not your root problem, so feel free to open any other issues or ask questions if it turns out the SDK is doing something weird with your node-pre-gyp code that causes your issue. Hope that helps! |
Thanks! Just had a chance to try latest master and the original error is gone with node v0.11.x. I'm now seeing this error but that may be something on my end. |
It's certainly possible that there are other 0.11.x related issues. I know that we have had issues testing against various 0.11.x versions with the SDK, especially when it comes to passing streams through to S3. It's unfortunate that you can't get logs from 0.10.x to see the original error. |
Yes, I'm going to hold on using v0.11.x for now. In the meantime I've figured out the cause for things not working on v0.10.x (mistake in s3 credentials) so I'm no longer forced to use v0.11.x. So, thanks! Once v0.12.x is out I'll be sure to help test aws-sdk again. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Running into an odd error whereby
AWS.DynamoDB
is not defined right here.This may be something messed up on the box experiencing the error, but figured it would be good to report it nevertheless. The situation is:
require('aws-sdk
)` but its hard to tell, might be anywhere inside https://github.com/mapbox/node-pre-gyp/blob/master/lib/publish.js.Here is the log where it happens: https://ci.appveyor.com/project/springmeyer/node-mapnik/build/1.0.104#L1225
Any ideas what I might test to try to workaround?
The text was updated successfully, but these errors were encountered: