aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.6k stars 1.55k forks source link

AWS.CloudSearchDomain() is not working #347

Closed EricYang closed 10 years ago

EricYang commented 10 years ago

var AWS = require('aws-sdk'); var csd = new AWS.CloudSearchDomain({endpoint: 'my.host.tld'}); csd.search(params, function (err, data) { if (err) console.log(err, err.stack); // an error occurred else console.log(data); // successful response });

response: throw error: TypeError: undefined is not a function

AdityaManohar commented 10 years ago

Which line is the error being thrown from? If you print err.stack from your callback it should print out a full stack trace.

I tried to run this in node and I am not able to reproduce any issue. Are you by any chance running this in the browser?

EricYang commented 10 years ago

var AWS = require('aws-sdk'); try{ var csd = new AWS.CloudSearchDomain({endpoint: 'my.host.tld'}); }catch(error){ console.log('error:',error.stack) }

TypeError: undefined is not a function at Object. (/home/ec2-user/ericyang/dev/rest/test.js:3:11) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:487:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9)

EricYang commented 10 years ago

I tried to print property of AWS below and I can't found any function about 'CloudSearchDomain'. AWS's property: util,VERSION,ServiceInterface,Signers,XML,Service,Credentials,CredentialProviderChain,TemporaryCredentials,WebIdentityCredentials,SAMLCredentials,Config,config,Endpoint,HttpRequest,HttpResponse,HttpClient,SequentialExecutor,JSON,QueryParamSerializer,EventListeners,Request,Response,ResourceWaiter,ParamValidator,events,NodeHttpClient,SES,IAM,SimpleDB,CloudTrail,ElastiCache,Route53,Support,CloudWatch,ELB,OpsWorks,SWF,EC2,DataPipeline,SQS,RDS,DynamoDB,Glacier,CloudSearch,StorageGateway,AutoScaling,Redshift,STS,CloudFront,SNS,EMR,CloudFormation,ElasticBeanstalk,S3,DirectConnect,ImportExport,ElasticTranscoder,Kinesis,MetadataService,EC2MetadataCredentials,EnvironmentCredentials,FileSystemCredentials

AdityaManohar commented 10 years ago

Thanks for the stack trace! Which version of the SDK are you using?

EricYang commented 10 years ago

"name": "aws-sdk", "description": "AWS SDK for JavaScript", "version": "2.0.15"

lsegal commented 10 years ago

@EricYang can you print the AWS.VERSION in your script? Also, what version of Node.js are you using, and what OS are you running this on?

EricYang commented 10 years ago

Info as below AWS.VERSION: 2.0.0-rc.14 node: v0.8.1 os:Linux xxxxxx.amzn1.x86_64 #1 SMP Wed Apr 2 09:36:59 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

lsegal commented 10 years ago

Support for CloudSearchDomain was added in a later release than the one you are using. I would recommend updating your SDK to the latest (2.0.15) via npm install aws-sdk@2.0.15.

I am going to close this issue since this seems to be the cause. Feel free to reopen if you are still having trouble after updating the SDK.

EricYang commented 10 years ago

its weird, I tried to update sdk sudo npm install aws-sdk@2.0.15 but I found the AWS.VERSION is still 2.0.0-rc.14

EricYang commented 10 years ago

Oh I'm sorry that I update the sdk from wrong path!! orz....sorry Thank you very much.

lsegal commented 10 years ago

As a sidenote, you should not be using sudo to install npm packages, as they always reside inside your application path, and never in a system directory.

EricYang commented 10 years ago

got it! thanks.^^

lock[bot] commented 5 years ago

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.