-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An accessor cannot be declared in an ambient context - @aws-amplify - 1.2.5-unstable.5 #4389
Comments
Can you please provide some context?
|
I am using "aws-amplify": "^1.2.5-unstable.11" for login purpose in angular 8 universal. On stable version gives "WINDOW NOT DEFINED" error and I add the unstable version "1.2.5-unstable.5" and on that time it works fine. But as now, it won't allow me deploy as well as run on local machine with "ng serve". ng serve chunk {main} main.js, main.js.map (main) 2.02 kB [initial] [rendered] ERROR in ../node_modules/@aws-amplify/core/lib-esm/ServiceWorker/ServiceWorker.d.ts:23:9 - error TS1086: An accessor cannot be declared in an ambient context. 23 get serviceWorker(): ServiceWorker; 8 protected get options(): InteractionsOptions; 3 protected get region(): any; 5 protected get endpoint(): Promise; 12 get allClients(): string[]; 18 protected get clientId(): any; 19 protected get endpoint(): any; 20 protected get clientsQueue(): ClientsQueue; 21 protected get isSSLEnabled(): boolean; 9 protected get options(): ProvidertOptions; 13 private get awsAppSyncProvider(); 8 protected get options(): ProviderOptions; ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** |
I'm having the same problem using @aws-cdk > tsc
node_modules/@aws-cdk/core/lib/cfn-element.d.ts:52:9 - error TS1086: An accessor cannot be declared in an ambient context.
52 get creationStack(): string[];
~~~~~~~~~~~~~
node_modules/@aws-cdk/core/lib/cfn-element.d.ts:77:9 - error TS1086: An accessor cannot be declared in an ambient context.
77 get ref(): string;
~~~
node_modules/@aws-cdk/core/lib/cfn-parameter.d.ts:100:9 - error TS1086: An accessor cannot be declared in an ambient context.
100 get noEcho(): boolean;
~~~~~~
node_modules/@aws-cdk/core/lib/cfn-parameter.d.ts:104:9 - error TS1086: An accessor cannot be declared in an ambient context.
104 get value(): IResolvable;
~~~~~
node_modules/@aws-cdk/core/lib/cfn-parameter.d.ts:108:9 - error TS1086: An accessor cannot be declared in an ambient context. |
We are facing the same issue in AWS CodeBuild pipeline with Angular universal 8 and "aws-amplify": "^2.1.0" |
I had try with "aws-amplify": "^2.1.1-unstable.0" , but it can't work with latest unstable version. ERROR in ../node_modules/@aws-amplify/core/lib-esm/ServiceWorker/ServiceWorker.d.ts:23:9 - error TS1086: An accessor cannot be declared in an ambient context. 23 get serviceWorker(): ServiceWorker; |
I found out that this error was because last version of aws-cdk (v. 1.16.0) had breaking changes on Stack generation.
node_modules/@aws-cdk/core/lib/cfn-element.d.ts 52 readonly creationStack: string[];
node_modules/@aws-cdk/core/lib/cfn-element.d.ts 52 get creationStack(): string[]; This getter (and all new ones in other files) is what is crashing the Stack generation. |
@vc-ishver Thank you for the additional info. PR with the fix is up. Will update this issue once it's merged |
This issue was caused by changes to declaration files generated by TypeScript 3.7+, which are incompatible with the versions of TypeScript supported by current versions of Angular Compiler. Building aws-amplify with TypeScript 3.6.4 resolves the issue. |
@iartemiev Thank you. |
@vc-ishver @ekzGuille please try the latest unstable version of aws-amplify (2.1.1-unstable.5 |
TypeScript 3.7 generates a .d.ts with setter and getter incompatible with old versions of TS, such as the ones Angular 7 and 8 depend on. See aws-amplify/amplify-js#4389 (comment)
TypeScript 3.7 generates a .d.ts with setter and getter incompatible with old versions of TS, such as the ones Angular 7 and 8 depend on. See aws-amplify/amplify-js#4389 (comment)
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
ERROR in ·[96m../node_modules/@aws-amplify/core/lib-esm/ServiceWorker/ServiceWorker.d.ts·[0m:·[93m23·[0m:·[93m9·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m23·[0m get serviceWorker(): ServiceWorker;
·[7m ·[0m ·[91m ~~~~~~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/PubSub.d.ts·[0m:·[93m13·[0m:·[93m17·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m13·[0m private get awsAppSyncProvider();
·[7m ·[0m ·[91m ~~~~~~~~~~~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/PubSubProvider.d.ts·[0m:·[93m9·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m9·[0m protected get options(): ProvidertOptions;
·[7m ·[0m ·[91m ~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/MqttOverWSProvider.d.ts·[0m:·[93m12·[0m:·[93m9·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m12·[0m get allClients(): string[];
·[7m ·[0m ·[91m ~~~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/MqttOverWSProvider.d.ts·[0m:·[93m18·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m18·[0m protected get clientId(): any;
·[7m ·[0m ·[91m ~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/MqttOverWSProvider.d.ts·[0m:·[93m19·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m19·[0m protected get endpoint(): any;
·[7m ·[0m ·[91m ~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/MqttOverWSProvider.d.ts·[0m:·[93m20·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m20·[0m protected get clientsQueue(): ClientsQueue;
·[7m ·[0m ·[91m ~~~~~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/MqttOverWSProvider.d.ts·[0m:·[93m21·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m21·[0m protected get isSSLEnabled(): boolean;
·[7m ·[0m ·[91m ~~~~~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSIotProvider.d.ts·[0m:·[93m3·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m3·[0m protected get region(): any;
·[7m ·[0m ·[91m ~~~~~~·[0m
·[96m../node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSIotProvider.d.ts·[0m:·[93m5·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m5·[0m protected get endpoint(): Promise;
·[7m ·[0m ·[91m ~~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/interactions/lib-esm/Providers/InteractionsProvider.d.ts·[0m:·[93m8·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m8·[0m protected get options(): InteractionsOptions;
·[7m ·[0m ·[91m ~~~~~~~·[0m
·[96m../node_modules/@aws-amplify/xr/lib-esm/Providers/XRProvider.d.ts·[0m:·[93m8·[0m:·[93m19·[0m - ·[91merror·[0m·[90m TS1086: ·[0mAn accessor cannot be declared in an ambient context.
·[7m8·[0m protected get options(): ProviderOptions;
·[7m ·[0m ·[91m ~~~~~~~·[0m
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vivanco@0.0.0 build:client-and-server-bundles:
ng build --prod && ng run vivanco:server:production
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vivanco@0.0.0 build:client-and-server-bundles script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-11-13T07_27_56_230Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vivanco@0.0.0 build:ssr:
npm run build:client-and-server-bundles && npm run compile:server
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vivanco@0.0.0 build:ssr script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-11-13T07_27_56_243Z-debug.log
[Container] 2019/11/13 07:27:56 Command did not exit successfully npm run build:ssr exit status 1
[Container] 2019/11/13 07:27:56 Phase complete: POST_BUILD State: FAILED
[Container] 2019/11/13 07:27:56 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run build:ssr. Reason: exit status 1
[Container] 2019/11/13 07:27:56 Expanding base directory path: .
[Container] 2019/11/13 07:27:56 Assembling file list
[Container] 2019/11/13 07:27:56 Expanding .
[Container] 2019/11/13 07:27:56 Expanding file paths for base directory .
[Container] 2019/11/13 07:27:56 Assembling file list
[Container] 2019/11/13 07:27:56 Expanding template.yml
[Container] 2019/11/13 07:27:56 Expanding README.md
[Container] 2019/11/13 07:27:56 Expanding package.json
[Container] 2019/11/13 07:27:56 Expanding appspec.yml
[Container] 2019/11/13 07:27:56 Expanding scripts/*
[Container] 2019/11/13 07:27:56 Expanding node_modules//*
[Container] 2019/11/13 07:27:56 Expanding dist//*
[Container] 2019/11/13 07:27:56 Expanding template-configuration.json
[Container] 2019/11/13 07:27:56 Found 75714 file(s)
[Container] 2019/11/13 07:28:15 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2019/11/13 07:28:15 Phase context status code: Message:
The text was updated successfully, but these errors were encountered: