question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in connect-streams.js: Cannot set property 2011-06-15 of [object Object]

See original GitHub issue

I have integrated Amazon Connect Streams (through NPM) to Angular 9 project and everything worked as a charm, but after transferring all of the code from child to parent folder and running ng serve again I got this error.

connect-streams.js:20985 Uncaught TypeError: Cannot set property 2011-06-15 of [object Object] which has only a getter
   at Object.push../node_modules/amazon-connect-streams/release/connect-streams.js.107.../apis/connect-2017-02-15.min (connect-streams.js:20985)
   at o (connect-streams.js:4)
   at r (connect-streams.js:4)
   at Object../node_modules/amazon-connect-streams/release/connect-streams.js (connect-streams.js:4)
   at __webpack_require__ (bootstrap:79)
   at Module../src/app/app.module.ts (app.module.ts:1)
   at __webpack_require__ (bootstrap:79)
   at Module../src/main.ts (main.ts:1)
   at __webpack_require__ (bootstrap:79)
   at Object.0 (main.ts:12)

Error is caused by this line in connect-streams.js: AWS.apiLoader.services['sts']['2011-06-15'] = require('../apis/sts-2011-06-15.min');

"typescript": "^3.9.6"
"amazon-connect-streams": "^1.4.9"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
tecstangcommented, Jul 13, 2020

Try importing amazon-connect-streams asynchronously in the ngOnInit() method.

  ngOnInit(): void {
    this.initAmazonConnectStreams();
  }

  private initAmazonConnectStreams(): void {
    from(import('amazon-connect-streams/release/connect-streams-min.js')).pipe(
      take(1),
      tap(() => this.initCCP()
    )).subscribe();
  }

  private initCCP(): void {
    const ccpContainer = this.ccpContainer.nativeElement;
    connect.core.initCCP(ccpContainer, this.config);
    this.connectInitState.upadteStateToInitialized();
  }

This way you avoid the initial TypeError (and possibly a follow-up window reference error). That’s how i got it to work with Angular 9 and Angular 10.

0reactions
Rynxiaocommented, Jun 16, 2021

Still facing this issue when I import as the es way.

import 'amazon-connect-streams';

So I use script to import the sdk directly in the html. Worked as expected!

<script src="./node_modules/amazon-connect-streams/release/connect-streams-min.js"></script>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot set property 2011-06-15 of #<Object> which has only ...
It's not a pretty solution, but I solved the error by downloading the following amazon-connect-streams release file and commenting out the code ...
Read more >
Typescript: can't augment namespace - Stack Overflow
I'm using "amazon-connect-streams" npm package. The package has a few mismatches between the type definition and the javascript runtime.
Read more >
Embedding The Amazon Connect CCP in Angular - 5K Team
First, you will need to update the app's dependencies to include Amazon Connect Streams library. For this you can install via npm: "npm ......
Read more >
I use the Amazon Connect Streams API
using your AWS account. Navigate to the Amazon Connect console. Check that you're in the correct Region for your Amazon Connect instance.
Read more >
Amazon Connect Streams API Changelog #1: Through May ...
Amazon Connect Streams API (Streams) allows developers to create custom ... methods are in the api.js file, hanging off the agent object.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found