While my pipeline execute `npx sst deploy --stage ...
# general
h
While my pipeline execute
npx sst deploy --stage <STAGE_NAME>
i got that ERROR "Cannot find module '../package.json'" despite executeation of
ls -a
lists it
Copy code
.build
.gitignore
.sst
README.md
node_modules
package-lock.json
package.json
src
sst.json
stacks
test
tsconfig.json
Any help ?
t
is this at the root of your repo?
h
Yes i believe that , inside my SST project
t
can I see your stacks code
h
now, i build my pipeline against sample one (Basic ) Later , when i have it build successfully will move it to the right project .
Copy code
export default class MyStack extends sst.Stack {
  constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
    super(scope, id, props);

    // Create a HTTP API
    const api = new sst.Api(this, "Api", {
      routes: {
        "GET /": "src/lambda.handler",
      },
    });

    const table = new Table(this, "Notes", {
      partitionKey: {
        name: "pk",
        type: AttributeType.STRING,
      },
      sortKey: {
        name: "sk0",
        type: AttributeType.STRING,
      },
    });
    // Show the endpoint in the output
    this.addOutputs({
      ApiEndpoint: api.url,
    });
  }
}
t
when you say pipeline, what do you mean?
h
CI/CD pipeline , more specific CDK one
a
Does the
sst deploy
work when run locally, outside of CDK Pipeline?
h
@Adam Fanello Yes just tried and it deployed successfully
a
Can you provide the full output of when it is running and failing within CodePipeline? Maybe someone here can spot the difference.
h
Here's the output error of that deployment
a
The previous 106 lines may be helpful. Can you copy & paste the text?
h
Copy code
[Container] 2022/02/23 19:24:11 Waiting for agent ping
[Container] 2022/02/23 19:24:12 Waiting for DOWNLOAD_SOURCE
[Container] 2022/02/23 19:24:22 Phase is DOWNLOAD_SOURCE
[Container] 2022/02/23 19:24:22 CODEBUILD_SRC_DIR=/codebuild/output/src802188544/src
[Container] 2022/02/23 19:24:22 YAML location is /codebuild/readonly/buildspec.yml
[Container] 2022/02/23 19:24:22 Processing environment variables
[Container] 2022/02/23 19:24:22 No runtime version selected in buildspec.
[Container] 2022/02/23 19:24:24 Moving to directory /codebuild/output/src802188544/src
[Container] 2022/02/23 19:24:24 Configuring ssm agent with target id: codebuild:057c793d-c055-4c47-8a92-389538ab7270
[Container] 2022/02/23 19:24:24 Successfully updated ssm agent configuration
[Container] 2022/02/23 19:24:24 Registering with agent
[Container] 2022/02/23 19:24:24 Phases found in YAML: 2
[Container] 2022/02/23 19:24:24  INSTALL: 1 commands
[Container] 2022/02/23 19:24:24  BUILD: 5 commands
[Container] 2022/02/23 19:24:24 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2022/02/23 19:24:24 Phase context status code:  Message: 
[Container] 2022/02/23 19:24:24 Entering phase INSTALL
[Container] 2022/02/23 19:24:24 Running command npm cache --force clean && npm install --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN using --force I sure hope you know what you are doing.
npm WARN @aws-sdk/middleware-sdk-s3@3.52.0 requires a peer of @aws-sdk/signature-v4-crt@^3.31.0 but none is installed. You must install peer dependencies yourself.

added 19 packages from 5 contributors and audited 1595 packages in 9.599s

114 packages are looking for funding
  run `npm fund` for details

found 9 vulnerabilities (4 moderate, 2 high, 3 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

[Container] 2022/02/23 19:24:41 Phase complete: INSTALL State: SUCCEEDED
[Container] 2022/02/23 19:24:41 Phase context status code:  Message: 
[Container] 2022/02/23 19:24:41 Entering phase PRE_BUILD
[Container] 2022/02/23 19:24:41 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2022/02/23 19:24:41 Phase context status code:  Message: 
[Container] 2022/02/23 19:24:41 Entering phase BUILD
[Container] 2022/02/23 19:24:41 Running command echo START BUILD
START BUILD

[Container] 2022/02/23 19:24:41 Running command pwd
/codebuild/output/src802188544/src

[Container] 2022/02/23 19:24:41 Running command ls -a
.
..
.build
.env
.gitignore
.sst
README.md
node_modules
package-lock.json
package.json
src
sst.json
stacks
test
tsconfig.json

[Container] 2022/02/23 19:24:41 Running command ls -a .build
.
..
cdk.out
eslint.js
lib
package.json
run.js
sst-debug.log
sst-merged.json
static-site-environment-output-keys.json

[Container] 2022/02/23 19:24:41 Running command npx sst deploy --stage hbstackcicd
Attention: SST now collects completely anonymous telemetry regarding usage. This is used to guide SST's roadmap.
You can learn more, including how to opt-out of this anonymous program, by heading over to:
<https://docs.serverless-stack.com/anonymous-telemetry>

Cannot find module '../package.json'
Require stack:
- /codebuild/output/src802188544/src/node_modules/.bin/sst

[Container] 2022/02/23 19:24:43 Command did not exit successfully npx sst deploy --stage hbstackcicd exit status 1
[Container] 2022/02/23 19:24:43 Phase complete: BUILD State: FAILED
[Container] 2022/02/23 19:24:43 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npx sst deploy --stage hbstackcicd. Reason: exit status 1
[Container] 2022/02/23 19:24:43 Entering phase POST_BUILD
[Container] 2022/02/23 19:24:43 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2022/02/23 19:24:43 Phase context status code:  Message:
f
@hesham badawy was the
.build
folder commited to git? It seems to be there prior to running
sst deploy
h
@Frank Mmm, it was there actually . How u get that indication ? Removing those folder .build /.sst and make sure they be ignored by git while commit Still have the same issue . and i the output of
ls -a
at build pahse/stage
Copy code
[Container] 2022/02/23 23:24:34 Running command ls -a
.
..
.env
.gitignore
README.md
package-lock.json
package.json
src
sst.json
stacks
test
tsconfig.json
and the output of
ls -a
at deployment stage after successfully build
Copy code
[Container] 2022/02/23 23:27:08 Running command ls -a
.
..
.build
.env
.gitignore
.sst
README.md
node_modules
package-lock.json
package.json
src
sst.json
stacks
test
tsconfig.json
@thdxr @Frank @Adam Fanello Thanks all for ur try to asset here, I've figured that out now the deliver me to new role issue will try resolve that myself
f
@hesham badawy Nice! I just saw it in the previous terminal output you shared