Reputation: 34513
The code below generates this error with AWS Transcribe on iOS:
Task <1B377509-91AE-43C0-8F24-F28FE7B583AC>.<1> load failed with error Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo={_kCFStreamErrorCodeKey=8, NSUnderlyingError=0x283cb55f0 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <1B377509-91AE-43C0-8F24-F28FE7B583AC>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <1B377509-91AE-43C0-8F24-F28FE7B583AC>.<1>" ), NSLocalizedDescription=A server with the specified hostname could not be found., NSErrorFailingURLStringKey=https://transcribe.us-west-1.amazonaws.com/, NSErrorFailingURLKey=https://transcribe.us-west-1.amazonaws.com/, _kCFStreamErrorDomainKey=12} [-1003]
US-West1 is a supported region for AWS Transcribe. Why is this error happening?
class TranscriptionNewViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
// =============================================================================================================
// MARK: Transcription Functions
// =============================================================================================================
fileprivate func transcribe() {
let fileURL = "https://s3-us-west-2.amazonaws.com/blahblahblah/Sample1.mp3"
let jobName = "sample1"
let languageCode = AWSTranscribeLanguageCode.enUS
let mediaFormat = AWSTranscribeMediaFormat.mp3
let media = AWSTranscribeMedia()
media?.mediaFileUri = fileURL
let jobRequest = AWSTranscribeStartTranscriptionJobRequest()
jobRequest?.transcriptionJobName = jobName
jobRequest?.languageCode = languageCode
jobRequest?.mediaFormat = mediaFormat
jobRequest?.media = media
let transcribeClient = AWSTranscribe.default()
DispatchQueue.global(qos: .background).async {
transcribeClient.startTranscriptionJob(jobRequest!) { response, error in
guard let response = response else {
print("Failed to start transcription")
return
}
print(response.transcriptionJob!.transcriptionJobStatus == .inProgress, "Status should have been in progress, but was \(response.transcriptionJob!.transcriptionJobStatus)")
self.transcribeJobDidFinish()
}
}
// Print status
print("Started transcription")
}
fileprivate func transcribeJobDidFinish() {
}
// =============================================================================================================
// MARK: IB Actions
// =============================================================================================================
@IBAction func transcribeButtonDidTap(_ sender: UIButton) {
transcribe()
}
// =============================================================================================================
// MARK: UIViewController Functions
// =============================================================================================================
override var prefersStatusBarHidden: Bool {
return true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Upvotes: 2
Views: 1323
Reputation: 2709
At present, only us-west-2
aws region for western part of US provides AWS Transcribe service. us-west-1
is not one of them, reason why you receive the hostname lookup error.
Complete list of available endpoints for most services can be found at https://docs.aws.amazon.com/general/latest/gr/rande.html, specifically under Amazon Transcribe
heading.
Upvotes: 1