ERROR ReferenceError: regeneratorRuntime is not defined
See original GitHub issueExpected Behavior
Expect Contentful SDK in Angular 11 project to work against sample space.
Actual Behavior
Browser throws error: core.js:5967 ERROR ReferenceError: regeneratorRuntime is not defined at Object._getEntries (create-contentful-api.js:393) at Object.getEntries (create-contentful-api.js:371) at AppComponent.ngOnInit (app.component.ts:26) at callHook (core.js:2486) at callHooks (core.js:2456) at executeInitAndCheckHooks (core.js:2408) at refreshView (core.js:9194) at renderComponentOrTemplate (core.js:9293) at tickRootContext (core.js:10519) at detectChangesInRootView (core.js:10544)
Possible Solution
Regarding #496, seems is not fixed.
Steps to Reproduce
package.json
{
"name": "contentful-product-catalog-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.0.5",
"@angular/common": "~11.0.5",
"@angular/compiler": "~11.0.5",
"@angular/core": "~11.0.5",
"@angular/forms": "~11.0.5",
"@angular/platform-browser": "~11.0.5",
"@angular/platform-browser-dynamic": "~11.0.5",
"@angular/router": "~11.0.5",
"contentful": "^8.1.6",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.5",
"@angular/cli": "~11.0.5",
"@angular/compiler-cli": "~11.0.5",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}
}
app.component.ts
import { Component, OnInit } from '@angular/core';
import { createClient } from 'contentful';
const CONFIG = {
space: 'wl1z0pal05vy',
accessToken:
'0e3ec801b5af550c8a1257e8623b1c77ac9b3d8fcfc1b2b7494e3cb77878f92a',
contentTypeIds: {
product: '2PqfXUJwE8qSYKuM0U6w8M',
},
};
@Component({
selector: 'app-root',
template: `<div>contentful test</div>`,
})
export class AppComponent implements OnInit {
private cdaClient = createClient({
space: CONFIG.space,
accessToken: CONFIG.accessToken,
});
ngOnInit(): void {
console.log(this.cdaClient);
this.cdaClient
.getEntries(
Object.assign({
content_type: CONFIG.contentTypeIds.product,
})
)
.then((a: any) => console.log(a));
}
}
Context
Angular SPA to use Contentful delivery/preview.
Environment
Angular CLI: 11.0.5 Node: 14.8.0 OS: darwin x64
Angular: 11.0.5 Ivy Workspace: Yes
@angular-devkit/architect 0.1100.5 @angular-devkit/build-angular 0.1100.5 @angular-devkit/core 11.0.5 @angular-devkit/schematics 11.0.5 @schematics/angular 11.0.5 @schematics/update 0.1100.5 rxjs 6.6.3 typescript 4.0.5
Chrome Version 87.0.4280.88 (Official Build) (x86_64) Edge Version 88.0.705.29 (Official build) Beta (64-bit) Safari Version 13.1.2 (13609.3.5.1.5)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:13 (4 by maintainers)
As a quick fix add the following two lines at the top of the app.component.ts file, you don’t get an error anymore
Hello,
I made a new PR addressing this problem. Once it’s approved, I’ll post an update here