question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[aws-lambda-nodejs] .parcel-cache permission denied in BitBucket Pipelines

See original GitHub issue

Bitbucket Pipeline failed to create NodejsFunction in docker. When I attempt to create a lambda using that construct and synthesize, I get an error [Error: EACCES: permission denied, mkdir ‘/asset-input/.parcel-cache’]

Reproduction Steps

import * as cdk from '@aws-cdk/core';
import * as nodejs from '@aws-cdk/aws-lambda-nodejs';

export class BugStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new nodejs.NodejsFunction(this, 'handler');
  }
}

The handler a bit complex to show here, but it is irrelevant.

Error Log

> zolar-cdk@1.0.0 deploy /opt/atlassian/pipelines/agent/build/.cdk
> cdk --trace deploy "-a" "projects/sfbridge/create.js"
Bundling asset dev-serg-test-sfbridge/dev-serg-test-sfbridge-sf-zpc-bridge/Code/Stage...
[Error: EACCES: permission denied, mkdir '/asset-input/.parcel-cache'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/asset-input/.parcel-cache'
}
/opt/atlassian/pipelines/agent/build/.cdk/node_modules/@aws-cdk/core/lib/asset-staging.js:123
            throw new Error(`Failed to run bundling Docker image for asset ${this.node.path}: ${err}`);
            ^
Error: Failed to run bundling Docker image for asset dev-serg-test-sfbridge/dev-serg-test-sfbridge-sf-zpc-bridge/Code/Stage: Error: docker exited with status 1
    at AssetStaging.bundle (/opt/atlassian/pipelines/agent/build/.cdk/node_modules/@aws-cdk/core/lib/asset-staging.js:123:19)
    at new AssetStaging (/opt/atlassian/pipelines/agent/build/.cdk/node_modules/@aws-cdk/core/lib/asset-staging.js:38:35)
    at new Asset (/opt/atlassian/pipelines/agent/build/.cdk/node_modules/@aws-cdk/aws-s3-assets/lib/asset.js:21:25)
    at AssetCode.bind (/opt/atlassian/pipelines/agent/build/.cdk/node_modules/@aws-cdk/aws-lambda/lib/code.js:137:26)
    at new Function (/opt/atlassian/pipelines/agent/build/.cdk/node_modules/@aws-cdk/aws-lambda/lib/function.js:80:33)
    at new NodejsFunction (/opt/atlassian/pipelines/agent/build/.cdk/node_modules/@aws-cdk/aws-lambda-nodejs/lib/function.js:30:13)
    at ZolarSFBridge.scheduleLambda (/opt/atlassian/pipelines/agent/build/.cdk/projects/sfbridge/ZolarSFBridge.js:34:24)
    at new ZolarSFBridge (/opt/atlassian/pipelines/agent/build/.cdk/projects/sfbridge/ZolarSFBridge.js:29:14)
    at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/.cdk/projects/sfbridge/create.js:7:19)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
Subprocess exited with error 1

Environment

  • CLI Version : 1.53.0
  • Framework Version: 1.53.0
  • Node.js Version: 12
  • OS : lambci/lambda:build-nodejs12.x
  • Language (Version): TypeScript (3.8.3)

Other

looks related to #8757


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rv-rmirandacommented, Sep 17, 2020

Please, let me know if you need anything else.

Are you using the docker executor or machine executor? https://support.circleci.com/hc/en-us/articles/360007324514-How-can-I-use-Docker-volume-mounting-on-CircleCI and https://circleci.com/docs/2.0/executor-types/#using-machine

@jogold — I was using docker executor, I change it to machine executor, and now is working! 🎉 🍻

Working Code

version: 2.1
jobs:
  build_and_deploy:
    machine:
      image: ubuntu-1604:202007-01
    working_directory: ~/repo
    steps:
      - checkout
      - attach_workspace:
          at: .
   
... MORE CODE ...

Not Working Code

version: 2.1
jobs:
  build_and_deploy:
    docker:
      - image: cimg/python:3.8.4
    working_directory: ~/repo
    steps:
      - checkout
      - attach_workspace:
          at: .

      - setup_remote_docker:
          version: 19.03.12
          docker_layer_caching: true

... MORE CODE ...

Thank you for the help!

1reaction
mbonigcommented, Aug 25, 2020

So, not sure if it helps anyone else, but I found I was having this similar issue. I had a direct “dependency” in my package.json to parcel and parcel-bundler. Removing those (and a rm -rf node_modules && npm i) resolved the issue for me.

Hope that helps someone else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SOLVED Pipeline Build Node JS fails with "permission denied ...
Solved: Doing a pipeline build with Node ( image : node:10.15.3) . First script command is to install a global dependency. That fails...
Read more >
Permission denied from Bitbucket pipeline - Stack Overflow
The issue is that the file was not given the correct execution permissions before it was checked into BitBucket.
Read more >
Cloning another Bitbucket repository in Bitbucket Pipelines
Our main repository now has read-only permissions to clone my-submodules from within its Pipelines. After the above configuration, executing a ...
Read more >
Deploying using Bitbucket Pipelines - AWS Documentation
Configure your Bitbucket Pipeline to deploy AWS SAM applications. ... your bitbucket-pipelines.yml file must contain lines that do the following:.
Read more >
Bitbucket Pipelines - Cypress Documentation
What you'll learn How to run Cypress tests with Bitbucket Pipelines as part of CI/CD ... Visibility into test failures via quick access...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found