Solution is not building/ deploying
stvius opened this issue · 5 comments
Describe the bug
I am following the steps to build and deploy the solution using AWS cloudShell but it is not succeeding
error:
`CDK version 1.143.0
------ EXEC npm run build
iot-static-ip-endpoints@1.0.0 build /home/cloudshell-user/iot-static-ip-endpoints/source
tsc
lib/GreengrassVpnService.ts:90:7 - error TS2322: Type 'SolutionVpc' is not assignable to type 'IVpc'.
90 vpc: props.vpc,
~~~
node_modules/@aws-cdk/aws-ec2/lib/security-group.d.ts:184:14
184 readonly vpc: IVpc;
~~~
The expected type comes from property 'vpc' which is declared here on type 'SecurityGroupProps'
lib/GreengrassVpnService.ts:98:7 - error TS2322: Type 'SolutionVpc' is not assignable to type 'IVpc'.
98 vpc: props.vpc,
~~~
node_modules/@aws-cdk/aws-efs/lib/efs-file-system.d.ts:151:14
151 readonly vpc: ec2.IVpc;
~~~
The expected type comes from property 'vpc' which is declared here on type 'FileSystemProps'
lib/NLBEC2Service.ts:128:7 - error TS2739: Type 'SolutionVpc' is missing the following properties from type 'IVpc': vpcArn, addClientVpnEndpoint, applyRemovalPolicy
128 vpc: props.vpc
~~~
node_modules/@aws-cdk/aws-ec2/lib/security-group.d.ts:184:14
184 readonly vpc: IVpc;
~~~
The expected type comes from property 'vpc' which is declared here on type 'SecurityGroupProps'
lib/NLBEC2Service.ts:161:7 - error TS2322: Type 'SolutionVpc' is not assignable to type 'IVpc'.
161 vpc: props.vpc,
~~~
node_modules/@aws-cdk/aws-autoscaling/lib/auto-scaling-group.d.ts:328:14
328 readonly vpc: ec2.IVpc;
~~~
The expected type comes from property 'vpc' which is declared here on type 'AutoScalingGroupProps'
lib/NLBGlobalAccelerator.ts:15:84 - error TS2305: Module '"@aws-cdk/aws-globalaccelerator"' has no exported member 'EndpointConfiguration'.
15 import { Accelerator, Listener, EndpointGroup, CfnAccelerator, ConnectionProtocol, EndpointConfiguration } from "@aws-cdk/aws-globalaccelerator"
~~~~~~~~~~~~~~~~~~~~~
lib/SolutionSubnet.ts:17:14 - error TS2420: Class 'SolutionSubnet' incorrectly implements interface 'ISubnet'.
Property 'applyRemovalPolicy' is missing in type 'SolutionSubnet' but required in type 'ISubnet'.
17 export class SolutionSubnet implements ISubnet {
~~~~~~~~~~~~~~
node_modules/@aws-cdk/core/lib/resource.d.ts:76:5
76 applyRemovalPolicy(policy: RemovalPolicy): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'applyRemovalPolicy' is declared here.
lib/SolutionVpc.ts:54:14 - error TS2420: Class 'SolutionVpc' incorrectly implements interface 'IVpc'.
Type 'SolutionVpc' is missing the following properties from type 'IVpc': vpcArn, addClientVpnEndpoint, applyRemovalPolicy
54 export class SolutionVpc extends Construct implements IVpc {
~~~~~~~~~~~
lib/SolutionVpc.ts:283:9 - error TS2741: Property 'applyRemovalPolicy' is missing in type 'SolutionSubnet' but required in type 'ISubnet'.
283 new SolutionSubnet(this.cfnPublicSubnets[0], this.publicRouteTable),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@aws-cdk/core/lib/resource.d.ts:76:5
76 applyRemovalPolicy(policy: RemovalPolicy): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'applyRemovalPolicy' is declared here.
lib/SolutionVpc.ts:284:9 - error TS2322: Type 'SolutionSubnet' is not assignable to type 'ISubnet'.
284 new SolutionSubnet(this.cfnPublicSubnets[1], this.publicRouteTable)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/SolutionVpc.ts:292:9 - error TS2322: Type 'SolutionSubnet' is not assignable to type 'ISubnet'.
292 new SolutionSubnet(this.cfnPrivateSubnets[0], this.privateRouteTables[0]),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/SolutionVpc.ts:293:9 - error TS2322: Type 'SolutionSubnet' is not assignable to type 'ISubnet'.
293 new SolutionSubnet(this.cfnPrivateSubnets[1], this.privateRouteTables[1])
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/SolutionVpc.ts:312:5 - error TS2741: Property 'applyRemovalPolicy' is missing in type '{ subnetId: any; availabilityZone: any; internetConnectivityEstablished: boolean; ipv4CidrBlock: string; readonly routeTable: IRouteTable; associateNetworkAcl(): void; readonly node: ConstructNode; readonly env: ResourceEnvironment; readonly stack: Stack; }' but required in type 'ISubnet'.
312 return {
~~~~~~~~
313 subnetId: ifNat(pri.subnetId, pub.subnetId),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
331 }
~~~~~~~
332 }
~~~~~
node_modules/@aws-cdk/core/lib/resource.d.ts:76:5
76 applyRemovalPolicy(policy: RemovalPolicy): void;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'applyRemovalPolicy' is declared here.
test/SolutionSubnet.spec.ts:42:9 - error TS2571: Object is of type 'unknown'.
42 if (err.message !== "Not implemented") {
~~~
test/SolutionSubnet.spec.ts:55:9 - error TS2571: Object is of type 'unknown'.
55 if (err.message !== "Not implemented") {
~~~
test/SolutionVpc.spec.ts:200:9 - error TS2571: Object is of type 'unknown'.
200 if (err.message !== "not implemented") {
~~~
test/SolutionVpc.spec.ts:208:9 - error TS2571: Object is of type 'unknown'.
208 if (err.message !== "not implemented") {
~~~
test/SolutionVpc.spec.ts:216:9 - error TS2571: Object is of type 'unknown'.
216 if (err.message !== "not implemented") {
~~~
test/SolutionVpc.spec.ts:224:9 - error TS2571: Object is of type 'unknown'.
224 if (err.message !== "not implemented") {
~~~
test/SolutionVpc.spec.ts:232:9 - error TS2571: Object is of type 'unknown'.
232 if (err.message !== "not implemented") {
~~~
test/SolutionVpc.spec.ts:254:9 - error TS2571: Object is of type 'unknown'.
254 if (err.message !== "not implemented") {
~~~
test/SolutionVpc.spec.ts:262:9 - error TS2571: Object is of type 'unknown'.
262 if (err.message !== "not implemented") {
~~~
test/SolutionVpc.spec.ts:270:9 - error TS2571: Object is of type 'unknown'.
270 if (err.message !== "vpc.isolatedSubnets Not Implemented") {
~~~
test/SolutionVpc.spec.ts:278:9 - error TS2571: Object is of type 'unknown'.
278 if (err.message !== "vpc.vpnGatewayId Not Implemented") {
~~~
test/SolutionVpc.spec.ts:286:9 - error TS2571: Object is of type 'unknown'.
286 if (err.message !== "vpc.internetConnectivityEstablished Not Implemented") {
~~~
test/SolutionVpc.spec.ts:294:9 - error TS2571: Object is of type 'unknown'.
294 if (err.message !== "vpc.env Not Implemented") {
~~~
test/SolutionVpc.spec.ts:302:9 - error TS2571: Object is of type 'unknown'.
302 if (err.message !== "vpc.enableVpnGateway Not Implemented") {
~~~
test/SolutionVpc.spec.ts:310:9 - error TS2571: Object is of type 'unknown'.
310 if (err.message !== "vpc.addVpnConnection Not Implemented") {
~~~
test/SolutionVpc.spec.ts:318:9 - error TS2571: Object is of type 'unknown'.
318 if (err.message !== "vpc.addGatewayEndpoint Not Implemented") {
~~~
test/SolutionVpc.spec.ts:326:9 - error TS2571: Object is of type 'unknown'.
326 if (err.message !== "vpc.addInterfaceEndpoint Not Implemented") {
~~~
test/SolutionVpc.spec.ts:334:9 - error TS2571: Object is of type 'unknown'.
334 if (err.message !== "vpc.addFlowLog Not Implemented") {
~~~
Found 30 errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! iot-static-ip-endpoints@1.0.0 build: tsc
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the iot-static-ip-endpoints@1.0.0 build 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! /home/cloudshell-user/.npm/_logs/2022-02-08T17_23_07_794Z-debug.log
Aborted - rc=1`
Thanks for bringing this to our attention. It looks like we've forgot to commit package-lock.json. In addition to updating the package.json versions we'll also work to update all the dependencies and fix any compile errors.
In the meantime, below is a package.json you can use instead of the repo version with the exact versions of dependencies which successfully build/test/deploy.
{
"name": "iot-static-ip-endpoints",
"version": "1.0.0",
"license": "Apache-2.0",
"bin": {
"cdk-solution": "bin/app.js"
},
"scripts": {
"cleanup": "tsc --build ./ --clean && rm -rf node_modules && rm -f package-lock.json",
"clean": "rm -rf coverage/ lib/*.js lib/*.d.ts bin/*.js bin/*.d.ts test/*.js test/*.d.ts test/*.synth.json",
"build": "tsc",
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk",
"lint": "npx eslint --max-warnings=0 .",
"full-build": "npx eslint && npm run build && npm run test && cdk synth",
"full-build-prod": "npm run build && cdk synth",
"check": "npm run build && cdk synth",
"configure": "node configure.js",
"nag": "npm run build && cdk synth > iot-static-ip-endpoints.yaml && cfn_nag iot-static-ip-endpoints.yaml"
},
"devDependencies": {
"@aws-cdk/assert": "1.88.0",
"@types/jest": "26.0.20",
"@types/node": "14.14.25",
"@typescript-eslint/eslint-plugin": "4.14.2",
"@typescript-eslint/parser": "4.14.2",
"aws-cdk": "1.88.0",
"eslint": "7.19.0",
"jest": "26.6.3",
"source-map-support": "0.5.19",
"ts-jest": "26.5.0",
"ts-node": "9.1.1",
"typescript": "4.1.3"
},
"dependencies": {
"@aws-cdk/aws-autoscaling": "1.88.0",
"@aws-cdk/aws-ec2": "1.88.0",
"@aws-cdk/aws-elasticloadbalancingv2": "1.88.0",
"@aws-cdk/aws-events-targets": "1.88.0",
"@aws-cdk/aws-globalaccelerator": "1.88.0",
"@aws-cdk/aws-lambda": "1.88.0",
"@aws-cdk/aws-s3": "1.88.0",
"@aws-cdk/core": "1.88.0",
"@aws-cdk/custom-resources": "1.88.0",
"aws-sdk": "2.830.0"
},
"prettier": {
"tabWidth": 2,
"semi": false,
"printWidth": 150,
"trailingComma": "none"
}
}
Thank you for the prompt response.
I used the package.json
you provided above; now I got a new error. Below is the error part of the output:
`====================================
This is Python runtime
Collecting cryptography==3.3.1 (from -r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/7c/b6/1f3dd48a22fcd56f19e6cfa95f74ff0a64b046306354e1bd2b936b7c9ab4/cryptography-3.3.1-cp36-abi3-manylinux1_x86_64.whl
Collecting cffi>=1.12 (from cryptography==3.3.1->-r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/00/9e/92de7e1217ccc3d5f352ba21e52398372525765b2e0c4530e6eb2ba9282a/cffi-1.15.0.tar.gz
Collecting six>=1.4.1 (from cryptography==3.3.1->-r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.12->cryptography==3.3.1->-r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl
Installing collected packages: pycparser, cffi, six, cryptography
Running setup.py install for cffi ... error
Complete output from command /usr/bin/python3.8 -u -c "import setuptools, tokenize;file='/tmp/pip-build-o2umzas3/cffi/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-mnj5zld4-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmpxoae0ae2:
unable to execute 'gcc': No such file or directory
unable to execute 'gcc': No such file or directory
No working compiler found, or bogus compiler options passed to
the compiler from Python's standard "distutils" module. See
the error messages above. Likely, the problem is not related
to CFFI but generic to the setup.py of any Python package that
tries to compile C code. (Hints: on OS/X 10.8, for errors about
-mno-fused-madd see http://stackoverflow.com/questions/22313407/
Otherwise, see https://wiki.python.org/moin/CompLangPython or
the IRC channel #python on irc.libera.chat.)
Trying to continue anyway. If you are trying to install CFFI from
a build done in a different context, you can ignore this warning.
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/error.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/recompiler.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/pkgconfig.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_include.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/parse_c_type.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_embedding.h -> build/lib.linux-x86_64-3.8/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-3.8/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/c
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.8 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.8/c/_cffi_backend.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3.8 -u -c "import setuptools, tokenize;file='/tmp/pip-build-o2umzas3/cffi/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-mnj5zld4-record/install-record.txt --single-version-externally-managed --compile --home=/tmp/tmpxoae0ae2" failed with error code 1 in /tmp/pip-build-o2umzas3/cffi/`
Please advise
Can you list the command that causes the error, and anything leading up to the error?
Looks like you'll need a gcc compiler and python libraries. Try running these commands to install these prior to building:
sudo yum -y groupinstall 'Development Tools'
sudo yum -y install python38-devel libffi-devel
Also be aware. When you deploy the stack using CloudFormation. The template URL should have a . after s3 before the region, and not a dash:
Example:
--template-url=https://${BUCKET_NAME_PREFIX}-${AWS_REGION}.s3.${AWS_REGION}.amazonaws.com/${SOLUTION_TRADEMARKEDNAME}/v${VERSION}/${SOLUTION_TRADEMARKEDNAME}.template
Stale issue, closing.