Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Cannot parse "serverless.ts": Resolution of "ts-node" failed with: "ts-node" not found

Antonio Lopes July 10, 2023

Hey there,

According to the atlassian/serverless-deploy:1.2.0 (https://bitbucket.org/atlassian/serverless-deploy/src/master/), to set different Serverless configuration file we should define CONFIG param. However, it doesn't say anything about the ts-node.

Anyway, after config it according to the doc:

image: atlassian/default-image:3

pipelines:

pull-requests:

master:

- step:

name: Deploy to Production

deployment: Production

script:

- pipe: atlassian/serverless-deploy:1.0.0

variables:

AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY

AWS_DEFAULT_REGION: 'us-east-1'

CONFIG: 'serverless.ts'

EXTRA_ARGS: '--stage production --verbose'

I got the following error.

Screenshot 2023-07-10 at 10.41.53.png

So, I was wondering if you guys have any idea.

1 answer

1 accepted

1 vote
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 11, 2023

Hello @Antonio Lopes  and thank you for reaching out to Community! 

From the error being shown, it seems like your serverless deploy is looking for the ts-node package, but this does come installed in the pipe's container by default.

In such case, you can install the ts-node package and any other package you need by using the pipe's variable

PRE_EXECUTION_SCRIPT

This should point to a script file that will be run inside the pipe's container at the beginning of its execution.

In the example below, we are creating a script during the run-time to install typescript and ts-node packages, and executing it inside the pipe as a PRE_EXECUTION_SCRIPT : 

script:
  - echo 'npm install typescript ts-node' > .my-script.sh
  - chmod 005 my-script.sh
  - pipe: atlassian/serverless-deploy:1.2.0
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'us-east-1'
CONFIG: 'serverless.ts'
EXTRA_ARGS: '--stage production --verbose' PRE_EXECUTION_SCRIPT: '.my-script.sh'

Hope that helps! Let me know in case you have any questions.

Thank you, @Antonio Lopes !

Patrik S

Antonio Lopes July 21, 2023

Hey @Patrik S

 

Thanks! It worked.

Like Patrik S likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events