Closed EricYang closed 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?
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.
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
Thanks for the stack trace! Which version of the SDK are you using?
"name": "aws-sdk", "description": "AWS SDK for JavaScript", "version": "2.0.15"
@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?
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
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.
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
Oh I'm sorry that I update the sdk from wrong path!! orz....sorry Thank you very much.
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.
got it! thanks.^^
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