Error in NodeJS pipeline
Asked by rajputj3@bv.com:

I am getting following error. Would you please help?

Error:

Container 'Build' exceeded [memory limit](https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/#Service-memory-limits).

Here is my pipeline code.

# Template NodeJS build

# This template allows you to validate your NodeJS code.  
# The workflow allows running tests and code linting on the default branch.

image: node:14.18.1  
pipelines:  
branches:  
develop:  
- step:  
name: npm install and build  
caches:  
- node  
script:  
- npm install  
- npm run build  
# - npm test  
- step:  
name: Build \& Deploy to Test  
deployment: Test  
script:  
- echo $DEPLOYMENT_VARIABLE  
# - step:  
# name: Code linting  
# script:  
# - npm install eslint  
# - npx eslint .  
# caches:  
# - node


Answers:
author: Ben
body: Hi rajputj3_bv_com,

Please refer to our [documentation for troubleshooting](https://confluence.atlassian.com/bbkb/troubleshooting-bitbucket-pipelines-1141505226.html#TroubleshootingBitbucketPipelines-scenario12) - the easiest way to avoid encountering memory issues is to add the size attribute to your step to increase the available memory from 4GB to 8GB:

* **size: 2x**

We have relevant documentation below related to configuring the size attribute and also how memory allocation works in Pipelines

* [Step Options - Bitbucket Pipelines](https://support.atlassian.com/bitbucket-cloud/docs/step-options/#Size)
* [Pipelines - Memory Allocation](https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/)

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

comments: author: rajputj3@bv.com
body: Thank you. This worked.

I am having following error. Can you please help?

INFO: Starting deployment to Azure app service...  
az webapp deployment source config-zip --resource-group oneclick_002_test --name web-oneclick-test-02 --src drop.zip  
ERROR: Expecting value: line 1 column 1 (char 0)  
Traceback (most recent call last):  
File "/usr/local/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke  
cmd_result = self.invocation.execute(args)  
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in execute  
raise ex  
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 386, in _run_jobs_serially  
results.append(self._run_job(expanded_arg, cmd_copy))  
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 379, in _run_job  
six.reraise(\*sys.exc_info())  
File "/usr/local/lib/python3.6/site-packages/six.py", line 693, in reraise  
raise value  
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 356, in _run_job  
result = cmd_copy(params)  
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 171, in __call__  
return self.handler(\*args, \*\*kwargs)  
File "/usr/local/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 441, in default_command_handler  
return op(\*\*command_args)  
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 271, in enable_zip_deploy  
response = _check_zip_deployment_status(deployment_status_url, authorization, timeout)  
File "/usr/local/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 2054, in _check_zip_deployment_status  
res_dict = response.json()  
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 897, in json  
return complexjson.loads(self.text, \*\*kwargs)  
File "/usr/local/lib/python3.6/json/__init__.py", line 354, in loads  
return _default_decoder.decode(s)  
File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode  
obj, end = self.raw_decode(s, idx=_w(s, 0).end())  
File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode  
raise JSONDecodeError("Expecting value", s, err.value) from None  
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)  
INFO: Web App URL: <https://web-oneclick-test-02.azurewebsites.net>  
? Deployment failed.

This is my pipeline file.

# Template NodeJS build

# This template allows you to validate your NodeJS code.  
# The workflow allows running tests and code linting on the default branch.

image: atlassian/default-image:2  
pipelines:  
branches:  
master:  
- step:  
name: npm install and build  
image: node:14.18.1  
size: 2x  
caches:  
- node  
script:  
- npm install  
- npm run build  
- npm test  
# - zip -r drop-$BITBUCKET_BUILD_NUMBER.zip .  
- pipe: snyk/snyk-scan:1.0.1  
variables:  
SNYK_TOKEN: $SNYK_API_TOKEN  
LANGUAGE: "node" # Required unless SNYK_TEST_JSON_INPUT is set  
IMAGE_NAME: "\<string\>" # Only required if LANGUAGE set to "docker"  
SNYK_BASE_IMAGE: "\<string\>" # Custom base image  
CODE_INSIGHTS_RESULTS: "true" # Optional.  
SNYK_TEST_JSON_INPUT: "\<string\>" # Optional. The filename or path of a JSON file containg the output from running a test with the Snyk CLI (with json output option).  
PROTECT: "\<boolean\>" # Optional.  
DONT_BREAK_BUILD: "\<boolean\>" # Optional.  
MONITOR: "true" # Optional.  
SEVERITY_THRESHOLD: "\<low\|medium\|high\|critical\>" # Optional.  
ORGANIZATION: "\<string\>" # Optional.  
PROJECT_FOLDER: "from-azure-devops" # Optional.  
TARGET_FILE: "\<string\>" # Optional.  
EXTRA_ARGS: "all-projects" # Optional.  
DEBUG: "\<boolean\>" # Optional.  
SNYK_API: "\<string\>" # Optional.  
artifacts:  
- dist/\*\*  
- step:  
name: Build zip  
script:  
- zip -r drop.zip dist  
#- cd dist  
# - zip -r ../drop.zip ./\*  
# - cd ..  
# - ls -a  
# - zip -r drop.zip . -i dist/\*\*  
artifacts:  
- drop.zip  
- step:  
name: "Deploy to Test"  
deployment: test  
script:  
- pipe: microsoft/azure-web-apps-deploy:1.0.4  
variables:  
AZURE_APP_ID: $AZURE_APP_ID  
AZURE_PASSWORD: $AZURE_PASSWORD  
AZURE_TENANT_ID: $AZURE_TENANT_ID  
AZURE_RESOURCE_GROUP: 'oneclick_002_test'  
AZURE_APP_NAME: 'web-oneclick-test-02'  
ZIP_FILE: 'drop.zip'


author: Ben
body: Hi rajputj3,

You will need to reach out to Microsoft for further troubleshooting regarding the error messages you are facing with the pipe. This pipe is developed, maintained and supported by Microsoft and falls outside of our [support scope:](https://confluence.atlassian.com/support/atlassian-support-offerings-193299636.html)

* <https://developercommunity.visualstudio.com/spaces/21/index.html.>

Cheers!

- Ben (Bitbucket Cloud Support)


Tags: bitbucket-cloud

cloud