Giter VIP home page Giter VIP logo

Comments (8)

mullermp avatar mullermp commented on September 24, 2024

Hey @bismark64, CDK (unlike SDK) makes breaking changes. It's possible that it has happened here. Could you try running tsc (from your node_modules path) on your cdk-sample directory directly and see what javascript errors exist?

from aws-rails-provisioner.

bismark64 avatar bismark64 commented on September 24, 2024

After following your advice running tsc directly I found the issue is related to a mismatch on the expected type for domainZone:

lib/vthere-fargate-stack.ts:95:13 - error TS2322: Type 'string' is not assignable to type 'IHostedZone | undefined'.

95             domainZone: 'example.com',
               ~~~~~~~~~~

Is it absolutely necessary to include this field? I've specified a domain_name in the aws-rails-provisioner.yml file as well.

from aws-rails-provisioner.

mullermp avatar mullermp commented on September 24, 2024

Domain name appears to be used right above domain zone:

{{#domain_name}}
domainName: '{{.}}',
{{/domain_name}}

Are you defining domain zone in your YAML configuration? If not you can probably leave it out. AFAIK configuration is only used for generating the relevant typescript CDK code.

It seems that domainZone used to take a string but now takes a type IHostedZone (https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-route53.IHostedZone.html). I suppose that this object can be constructed and passed "example.com" as "zoneName" for IHostedZone.

from aws-rails-provisioner.

bismark64 avatar bismark64 commented on September 24, 2024

Yes I'm defining a domain zone, if I remove it from the YAML file it works fine.

In case anyone else is having this issue I just replaced:

domainZone: 'example.com', to

domainZone: route53.HostedZone.fromLookup(this, 'DomainZone', { domainName: 'example.com' }),
or
domainZone: route53.HostedZone.fromHostedZoneAttributes(this, 'DomainZone', { zoneName: 'example.com', hostedZoneId: 'ZXXXXXXXXXXX' }),

which they both return a IHostedZone type, and then run tsc again with no issues.

from aws-rails-provisioner.

mullermp avatar mullermp commented on September 24, 2024

Awesome. Happy to take a pull request if you want to contribute a fix back :)

from aws-rails-provisioner.

chrisgeek avatar chrisgeek commented on September 24, 2024

I am currently facing the same problem,
aws-rails-provisioner returns

Applying project template app for typescript
# Welcome to your CDK TypeScript project!

This is a blank project for TypeScript development with CDK.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

 * `npm run build`   compile typescript to js
 * `npm run watch`   watch for changes and compile
 * `npm run test`    perform the jest unit tests
 * `cdk deploy`      deploy this stack to your default AWS account/region
 * `cdk diff`        compare deployed stack with current state
 * `cdk synth`       emits the synthesized CloudFormation template

Executing npm install...
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

✅ All done!
creating cdk-sample/lib/cdk-sample-init-stack.ts
creating cdk-sample/lib/hospital-sys-fargate-stack.ts
replacing cdk-sample/bin/cdk-sample.ts
installing pkg: @aws-cdk/aws-ec2 ...
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

installing pkg: @aws-cdk/aws-ecs ...
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

installing pkg: @aws-cdk/aws-ecs-patterns ...
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

installing pkg: @aws-cdk/aws-ecr-assets ...
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

installing pkg: @aws-cdk/aws-rds ...
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

installing pkg: @aws-cdk/aws-secretsmanager ...
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

running npm run build ...
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build', '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'prebuild', 'build', 'postbuild' ]
npm info lifecycle [email protected]~prebuild: [email protected]
npm info lifecycle [email protected]~build: [email protected]
npm verb lifecycle [email protected]~build: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/chrisgeek/Documents/RailsProjects/hospital-sys/cdk-sample/node_modules/.bin:/home/chrisgeek/.rbenv/versions/2.5.1/bin:/home/chrisgeek/.rbenv/libexec:/home/chrisgeek/.rbenv/plugins/ruby-build/bin:/home/chrisgeek/.yarn/bin:/home/chrisgeek/.config/yarn/global/node_modules/.bin:/home/chrisgeek/.rbenv/plugins/ruby-build/bin:/home/chrisgeek/.rbenv/shims:/home/chrisgeek/.rbenv/bin:/home/chrisgeek/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
npm verb lifecycle [email protected]~build: CWD: /home/chrisgeek/Documents/RailsProjects/hospital-sys/cdk-sample
npm info lifecycle [email protected]~build: Failed to exec build script
npm verb stack Error: [email protected] build: `tsc`
npm verb stack Exit status 2
npm verb stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
npm verb stack     at EventEmitter.emit (events.js:198:13)
npm verb stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:198:13)
npm verb stack     at maybeClose (internal/child_process.js:982:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
npm verb pkgid [email protected]
npm verb cwd /home/chrisgeek/Documents/RailsProjects/hospital-sys/cdk-sample
npm verb Linux 4.15.0-122-generic
npm verb argv "/usr/bin/node" "/usr/bin/npm" "run" "build" "--verbose"
npm verb node v10.22.1
npm verb npm  v6.14.6
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 2, true ]
npm timing npm Completed in 28485ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/chrisgeek/.npm/_logs/2020-11-22T09_00_42_235Z-debug.log

when I run tsc I get the errors below

../bin/cdk-sample.ts:5:18 - error TS1005: ',' expected.

5 import { Hospital-sysFargateStack } from '../lib/hospital-sys-fargate-stack';
                   ~

../bin/cdk-sample.ts:5:35 - error TS1128: Declaration or statement expected.

5 import { Hospital-sysFargateStack } from '../lib/hospital-sys-fargate-stack';
                                    ~

../bin/cdk-sample.ts:5:42 - error TS1005: ';' expected.

5 import { Hospital-sysFargateStack } from '../lib/hospital-sys-fargate-stack';
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../lib/hospital-sys-fargate-stack.ts:9:19 - error TS1005: '{' expected.

9 interface Hospital-sysFargateStackProps {
                    ~

../lib/hospital-sys-fargate-stack.ts:9:41 - error TS1005: ';' expected.

9 interface Hospital-sysFargateStackProps {
                                          ~

../lib/hospital-sys-fargate-stack.ts:11:12 - error TS1005: ';' expected.

11     cluster: ecs.ICluster,
              ~

../lib/hospital-sys-fargate-stack.ts:12:1 - error TS1109: Expression expected.

12 }
   ~

../lib/hospital-sys-fargate-stack.ts:14:22 - error TS1005: '{' expected.

14 export class Hospital-sysFargateStack extends cdk.Stack {
                        ~

../lib/hospital-sys-fargate-stack.ts:14:39 - error TS1005: ';' expected.

14 export class Hospital-sysFargateStack extends cdk.Stack {
                                         ~~~~~~~

../lib/hospital-sys-fargate-stack.ts:14:57 - error TS1005: ';' expected.

14 export class Hospital-sysFargateStack extends cdk.Stack {
                                                           ~

../lib/hospital-sys-fargate-stack.ts:15:5 - error TS1128: Declaration or statement expected.

15     public readonly service: ecs.FargateService;
       ~~~~~~

../lib/hospital-sys-fargate-stack.ts:15:12 - error TS1128: Declaration or statement expected.

15     public readonly service: ecs.FargateService;
              ~~~~~~~~

../lib/hospital-sys-fargate-stack.ts:16:5 - error TS1128: Declaration or statement expected.

16     public readonly repoName: string;
       ~~~~~~

../lib/hospital-sys-fargate-stack.ts:16:12 - error TS1128: Declaration or statement expected.

16     public readonly repoName: string;
              ~~~~~~~~

../lib/hospital-sys-fargate-stack.ts:17:5 - error TS1128: Declaration or statement expected.

17     public readonly dbUrl: string;
       ~~~~~~

../lib/hospital-sys-fargate-stack.ts:17:12 - error TS1128: Declaration or statement expected.

17     public readonly dbUrl: string;
              ~~~~~~~~

../lib/hospital-sys-fargate-stack.ts:18:5 - error TS1128: Declaration or statement expected.

18     public readonly db: rds.DatabaseCluster;
       ~~~~~~

../lib/hospital-sys-fargate-stack.ts:18:12 - error TS1128: Declaration or statement expected.

18     public readonly db: rds.DatabaseCluster;
              ~~~~~~~~

../lib/hospital-sys-fargate-stack.ts:20:22 - error TS1005: ',' expected.

20     constructor(scope: cdk.App, id: string, props: Hospital-sysFargateStackProps) {
                        ~

../lib/hospital-sys-fargate-stack.ts:20:35 - error TS1005: ',' expected.

20     constructor(scope: cdk.App, id: string, props: Hospital-sysFargateStackProps) {
                                     ~

../lib/hospital-sys-fargate-stack.ts:20:50 - error TS1005: ',' expected.

20     constructor(scope: cdk.App, id: string, props: Hospital-sysFargateStackProps) {
                                                    ~

../lib/hospital-sys-fargate-stack.ts:20:83 - error TS1005: ';' expected.

20     constructor(scope: cdk.App, id: string, props: Hospital-sysFargateStackProps) {
                                                                                     ~


Found 22 errors.

from aws-rails-provisioner.

mullermp avatar mullermp commented on September 24, 2024

@chrisgeek I don't know much about typescript, but based on the errors above, I think it has difficulty with names using dashes Hospital-sysFargateStack. Try using naming like HostpitalSys maybe?

from aws-rails-provisioner.

chrisgeek avatar chrisgeek commented on September 24, 2024

@mullermp This is another issue where I implemented your suggestion #20

from aws-rails-provisioner.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.