Issues listing stacks with cdk ls #19866
-
Hi Community, I'm having an issue listing my cdk stacks after I created a cdk pipeline, I dont undertsand the error I'm getting. Please see error message and code below: Thanks in advance! :) ERROR MESSAGE
The above exception was the direct cause of the following exception:
CODE from argparse import Action
import code
from aws_cdk import (
Duration,
Stack,
aws_codepipeline as codepipeline,
pipelines as pipelines,
aws_codepipeline_actions as cpactions,
aws_secretsmanager as secretmanager,
SecretValue
)
from os import path
from constructs import Construct
from .webservice_stage import WebServiceStage
class PipelineStack(Stack):
def __init__(self, scope: Construct, construct_id: str, env, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
source_artifact = codepipeline.Artifact()
cloud_assembly_artifact = codepipeline.Artifact()
pipeline = pipelines.CodePipeline(
self,
"Pipeline",
pipeline_name='WebinarPipeline',
# cloud_assembly_artifact=cloud_assembly_artifact,
synth=pipelines.ShellStep(
"Synth",
# source_artifact=source_artifact,
# cloud_assembly_artifact=cloud_assembly_artifact,
input=pipelines.CodePipelineSource.git_hub('LuberCloudNinja/cdk-pipeline-webinar', 'main',
authentication=SecretValue.secrets_manager(
'GitHub-token')
),
commands=[
"npm install -g aws-cdk", # Installs the cdk cli on Codebuild
# Instructs Codebuild to install required packages
"pip install -r requirements.txt",
"npx cdk synth"
]
),
)
deploy = WebServiceStage(self, "Deploy", env=env)
deploy_stage = pipeline.add_stage(deploy) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hey @LuberCloudNinja, I've copied your file, but instead of To make sure it's not an error with anything you've done, try creating this in a fresh project and see if the issue persists |
Beta Was this translation helpful? Give feedback.
-
Hi @peterwoodworth, :) You're correct, my WebserviceStage.py file has a class that was inheriting the wrong class (STACK) I changed it to the STAGE class instead and everything started working. Thanks for taking time to help me bud! Have a great week! |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hey @LuberCloudNinja,
I've copied your file, but instead of
WebServiceStage
I've created my own stage which includes a separately defined stack. I'm not running into any errors here; I'd say that either there's some error with theWebServiceStage
stage you've built, or what I think is more likely is that one of your cdk modules is a different version from the rest / you didn'tpip install -r requirements.txt
since updating the versions.To make sure it's not an error with anything you've done, try creating this in a fresh project and see if the issue persists