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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,203
Community Members
 
Community Events
176
Community Groups

Error in pipeline: Error: Error: Cannot find module 'jsforce'

Our pipeline is throwing errors at a certain step. But running the same command in local works. Not sure what is happening. Any help is deeply appreciated.

 

Pipeline output:

+ npm run test
> makehttprequest@1.0.0 test /opt/atlassian/pipelines/agent/build/lambda_functions/makeHttpRequest
> npx cross-env NODE_ENV=dev nyc --reporter=html --reporter=text mocha --timeout 15000 --exit
npx: installed 7 in 1.561s
....
39 passing (2s)
11 pending
2 failing
1) makeHttpRequest
makeHttpRequest HTTP Post Learner:
Error: Error: Cannot find module 'jsforce'
at Object.exports.handler (index.js:3:1129)
at process._tickCallback (internal/process/next_tick.js:68:7)
2) makeHttpRequest
makeHttpRequest HTTP Get Learner response:
Error: Error: Cannot find module 'jsforce'
at Object.exports.handler (index.js:3:1129)
at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! makehttprequest@1.0.0 test: `npx cross-env NODE_ENV=dev nyc --reporter=html --reporter=text mocha --timeout 15000 --exit`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the makehttprequest@1.0.0 test 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! /root/.npm/_logs/2022-04-08T13_46_10_145Z-debug.log
Package.json:
{
        "dependencies": {
                "node-fetch": "^2.6.0",
                "jsforce": "^1.10.1"
          }
}
bitbucket-pipelines.yml:
        - step:
            name: 'makeHttpRequest'
            caches:
              - node
            condition:
              changesets:
                includePaths:
                  - 'lambda_functions/makeHttpRequest/**'
            script:
              - cat env.sh
              - source env.sh
              - cd ./lambda_functions/makeHttpRequest
              - npm i
              - npm run test
              - npm un -D
              - apt-get update && apt-get install -y zip
              - zip -r lambda_bundle.zip ./ -x *.json -x *.git* -x *.history* -x /coverage/* -x /logs/* -x /.nyc_output/* -x /.vscode/* -x /test/*
              - pipe: atlassian/aws-lambda-deploy:0.2.1
                variables:
                  AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
                  AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
                  AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
                  FUNCTION_NAME: 'makeHttpRequest'
                  COMMAND: 'update'
                  ZIP_FILE: 'lambda_bundle.zip'
              - source pipe.meta.env
              - pipe: atlassian/aws-lambda-deploy:0.2.1
                variables:
                  AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
                  AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
                  AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
                  FUNCTION_NAME: 'makeHttpRequest'
                  COMMAND: 'alias'
                  ALIAS: $ENV
                  VERSION: '${function_version}'
                  DESCRIPTION: $ENV-$(date +%Y-%m-%d)

1 answer

Hi @rbehera .

Please check that your package.json with `jsforce` in the folder  `/lambda_functions/makeHttpRequest`

When you do `npm i` npm tries to find package.json in the folder where you are.
Previously you did `cd ./lambda_functions/makeHttpRequest`
Maybe this is the problem.

Cheers.

@lissyaka Thanks! I did check it's there in `package.json` in dependencies.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events