Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70445

Error on PageModule When using AWS Polly

$
0
0

@Englishentry wrote:

Hello, I ran into GuidesPageModule Not Found error when trying to use Amazon AWS Polly SDK. Once i remove Amazon Polly the page works again. What could be the conflict between my page module and Polly SDK? Please help. Thanks.

Here is my service code:

import { Injectable } from '@angular/core';
import polly from 'aws-sdk/clients/polly';


declare var require: any;
const xmlbuilder = require('xmlbuilder');
// const AWS = require('aws-sdk');

@Injectable({
  providedIn: 'root'
})
export class TtsService {
 polly: any;
  constructor() {
  }

 async  convXml(text: string) {
    const xml_body = xmlbuilder.create('speak')
    .ele('prosody')
    .att('volume', 'loud')
    .att('rate', '90%')
    .att('pitch', 'medium')
    .txt(text)
    .end();
  // Convert the XML into a string to send in the TTS request.
  console.log(xml_body.toString());
  // Create an Polly client
  this.polly = new polly();
  const params = {
    'Text': xml_body.toString(),
    'TextType': 'ssml',
    'OutputFormat': 'mp3',
    'VoiceId': 'Amy',
    'LanguageCode': 'en-US'
  };
  await this.polly.synthesizeSpeech(params, (err, data) => {
    if (err) {
        console.log(err.code);
    } else if (data) {
      console.log(data);
        if (data.AudioStream instanceof Buffer) {
        }
    }
  });

  }
}

Initializing my Service on component page it stops working.

 constructor( private ttsService: TtsService) {
  }

Error Generated

core.js:15723 ERROR Error: Uncaught (in promise): Error: Cannot find module './guides/guides.module/'
Error: Cannot find module './guides/guides.module/'
    at $_lazy_route_resource lazy namespace object:79
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at Object.onInvoke (core.js:17298)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:390)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150)
    at zone.js:889
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:17289)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at resolvePromise (zone.js:831)
    at resolvePromise (zone.js:788)
    at zone.js:892
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:17289)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)
    at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:502)
    at invokeTask (zone.js:1744)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>