I'm trying to archive my react native application on xcode but I keep getting the following error
error node_modules/typescript/lib/typescript.js: Call retries were exceeded.
Error: Call retries were exceeded
at ChildProcessWorker.initialize (/Users/me/Desktop/app/reactnative_mobile/node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)
at ChildProcessWorker._onExit (/Users/me/Desktop/app/reactnative_mobile/node_modules/jest-worker/build/workers/ChildProcessWorker.js:274:12)
at ChildProcess.emit (node:events:513:28)
I've been trying to debug this for the past few days so any help would be greatly appreciated.
I've tried to remove jest-worker from node modules (as i'm not using it). I've also tried increasing the available memory for Node.js.
I’m fairly new to AWS Lambda and I’m trying to set-up my environment to be able to develop a Lambda function, using vscode and to be able to use a debugger. The way to do this appears to be to develop a SAM (serverless application model) application, containing the lambda function. So I’ve set everything up as per the “hello world” example in the AWS tutorial, and that all seems to work OK.
I have also created a standalone Lambda Function that successfully accesses the AWS-SDK to display some EC2 instance information (see below).
// Standalone Lambda Function that Works OK
const AWS = require('aws-sdk')
AWS.config.update({region: 'eu-west-2'});
const ec2 = new AWS.EC2();
exports.handler = async function(event) {
return ec2.describeInstances().promise();
}
The problem I’m having is combining the two: that is accessing the aws-sdk from a SAM application. What isn’t helping is that when I try and use one of the pre-provided SAM templates that do access the aws-sdk (e.g. the S3 one), they won’t even build.
So I guess I have two basic questions:
Is SAM the answer to being able to run and debug Node.js applications locally?
And if so, how do I get a working SAM application that uses the ‘aws-sdk’?
I’m on the latest version of everything. Node.js, SAM CLI, etc. The development machine is an ubuntu VM running on an ubuntu host. But the non aws-sdk example seems to work fine.
Example of the example SAM application not building.
$ sam init
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
What package type would you like to use?
1 - Zip (artifact is a zip uploaded to S3)
2 - Image (artifact is an image uploaded to an ECR image repository)
Package type: 1
Which runtime would you like to use?
1 - nodejs14.x
2 - python3.8
3 - ruby2.7
4 - go1.x
5 - java11
6 - dotnetcore3.1
7 - nodejs12.x
8 - nodejs10.x
9 - python3.7
10 - python3.6
11 - python2.7
12 - ruby2.5
13 - java8.al2
14 - java8
15 - dotnetcore2.1
Runtime: 1
Project name [sam-app]: sam-app-sdk-test
Cloning app templates from https://github.com/aws/aws-sam-cli-app-templates
AWS quick start application templates:
1 - Hello World Example
2 - Step Functions Sample App (Stock Trader)
3 - Quick Start: From Scratch
4 - Quick Start: Scheduled Events
5 - Quick Start: S3
6 - Quick Start: SNS
7 - Quick Start: SQS
8 - Quick Start: Web Backend
Template selection: 5
-----------------------
Generating application:
-----------------------
Name: sam-app-sdk-test
Runtime: nodejs14.x
Dependency Manager: npm
Application Template: quick-start-s3
Output Directory: .
Next steps can be found in the README file at ./sam-app-sdk-test/README.md
The build errors
sam build
Building codeuri: /media/sf_Virtual-machine-shr/DEV-Projects/OaC/sam-app-sdk-test runtime: nodejs14.x metadata: {} functions: ['S3Json
LoggerFunction']
Running NodejsNpmBuilder:NpmPack
Running NodejsNpmBuilder:CopyNpmrc
Running NodejsNpmBuilder:CopySource
Running NodejsNpmBuilder:NpmInstall
Build Failed
Error: NodejsNpmBuilder:NpmInstall - NPM Failed: npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.c
om/request/request/issues/3142
npm WARN deprecated request-promise-native#1.0.9: request-promise-native has been deprecated because it extends the now deprecated req
uest package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^2.1.2 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {
"os":"linux","arch":"x64"})
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! /home/peter/.npm/_logs/2021-04-25T14_35_13_711Z-debug.log
Turning the working Lambda Function Into a SAM Application
If I take my working Lambda Function and try to deploy it as a SAM application that builds and deploys OK, but won’t run.
Running locally
$ sam local invoke
Invoking app.lambdaHandler (nodejs14.x)
Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-nodejs14.x:rapid-1.22.0.
Mounting /media/sf_Virtual-machine-shr/DEV-Projects/OaC/backups/nc-sam-awsbackup-snapshots/.aws-sam/build/ShareSnapshotsFunction as /var/task:ro,delegated inside runtime container
START RequestId: bf15ac81-7d54-48ad-bbb7-df5e196c09f0 Version: $LATEST
2021-04-25T14:28:27.244Z undefined ERROR Uncaught Exception {"errorType":"Runtime.HandlerNotFound","errorMessage":"app.lambdaHandler is undefined or not exported","stack":["Runtime.HandlerNotFound: app.lambdaHandler is undefined or not exported"," at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)"," at Object.<anonymous> (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1063:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)"," at internal/main/run_main_module.js:17:47"]}
time="2021-04-25T14:28:27.252" level=panic msg="ReplyStream not available"
2021/04/25 14:28:27 http: panic serving 127.0.0.1:44020: &{0xc0000f4000 map[] 2021-04-25 14:28:27.252909676 +0000 UTC m=+0.322609308 panic <nil> ReplyStream not available <nil> <nil> }
goroutine 30 [running]:
<Stuff Cut Out>
2021-04-25T14:28:27.266Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"socket hang up","code":"ECONNRESET","stack":["Error: socket hang up"," at connResetException (internal/errors.js:607:14)"," at Socket.socketOnEnd (_http_client.js:493:23)"," at Socket.emit (events.js:327:22)"," at Socket.EventEmitter.emit (domain.js:467:12)"," at endReadableNT (internal/streams/readable.js:1327:12)"," at processTicksAndRejections (internal/process/task_queues.js:80:21)"]}
time="2021-04-25T14:28:27.288" level=error msg="Init failed" InvokeID= error="Runtime exited with error: exit status 129"
time="2021-04-25T14:28:27.288" level=error msg="INIT DONE failed: Runtime.ExitError"
Using "Invoke on AWS" from vscode.
Loading response...
Invocation result for arn:aws:lambda:eu-west-2:428829672862:function:nc-sam-awsbackup-snapshots-ShareSnapshotsFunction-Z9A1RR2GCQ9F
Logs:
START RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4 Version: $LATEST
2021-04-25T14:21:24.159Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","code":"EACCES","errno":-13,"syscall":"open","path":"/var/task/app.js","stack":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
END RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4
REPORT RequestId: f7a7d779-8ebd-4dde-987e-775f6116c2d4 Duration: 1439.52 ms Billed Duration: 1440 ms Memory Size: 128 MB Max Memory Used: 14 MB
Unknown application error occurred
Error
Payload:
{"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","trace":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
Loading response...
Invocation result for arn:aws:lambda:eu-west-2:428829672862:function:nc-sam-awsbackup-snapshots-ShareSnapshotsFunction-Z9A1RR2GCQ9F
Logs:
START RequestId: 779c6351-0775-4f04-8a5e-987791b027bf Version: $LATEST
2021-04-25T14:31:26.397Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","code":"EACCES","errno":-13,"syscall":"open","path":"/var/task/app.js","stack":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
END RequestId: 779c6351-0775-4f04-8a5e-987791b027bf
REPORT RequestId: 779c6351-0775-4f04-8a5e-987791b027bf Duration: 1449.59 ms Billed Duration: 1450 ms Memory Size: 128 MB Max Memory Used: 14 MB
Unknown application error occurred
Error
Payload:
{"errorType":"Error","errorMessage":"EACCES: permission denied, open '/var/task/app.js'","trace":["Error: EACCES: permission denied, open '/var/task/app.js'"," at Object.openSync (fs.js:476:3)"," at Object.readFileSync (fs.js:377:35)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1090:18)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
Running the Lambda Function within the AWS Console
Gives the same EACCES: permission denied
We have a NodeJS 10.16.3 Express API. We've recently switched from AWS Elastic Beanstalk/EC2 to Lambda / Serverless. Our DB is Postgres (PostgreSQL) 12.2.
It seemed all of a sudden I started getting this error on my local server when making requests from the client:
offline: ANY /dev/inventory/inventory (λ: app)
ERROR: aws-serverless-express connection error
{ Error: write EPIPE
at WriteWrap.afterWrite (net.js:788:14) errno: 'EPIPE', code: 'EPIPE', syscall: 'write' }
offline: (λ: app) RequestId: ckazracm0001emds69068drtu Duration: 2.58 ms Billed Duration: 100 ms
I can't seem to find much on this issue and I'm hoping someone can help.
Notes:
My local postgres is running
My .env.json file is correct
Found the error. Hopefully this will be helpful for others.
The error was due to exceeding the max cookie size of 4096 bytes in the application request headers. We solved it by stripping out erroneous cookies that were passed through some 3rd party services we were using, which has long encoded strings for cookie values.
I am getting error
Execution result: failed(logs)
Details
The area below shows the result returned by your function execution. Learn more about returning results from your function.
{
"errorMessage": "RequestId: eb7906af-f46d-11e8-ae3b-45487c02a68e Process exited before completing request"
}
Summary
Code SHA-256
ca50xloHl4xLOSWox2xidHxC1VHyNqwq3kECKraw7/c=
Request ID
eb7906af-f46d-11e8-ae3b-45487c02a68e
Duration
38.73 ms
Billed duration
100 ms
Resources configured
128 MB
Max memory used
19 MB
Log output
The section below shows the logging calls in your code. These correspond to a single row within the CloudWatch log group corresponding to this Lambda function. Click here to view the CloudWatch log group.
START RequestId: eb7906af-f46d-11e8-ae3b-45487c02a68e Version: $LATEST
2018-11-30T07:02:38.509Z eb7906af-f46d-11e8-ae3b-45487c02a68e TypeError: Cannot create property 'stack' on string 'Could not find ffmpeg executable, tried "/var/task/node_modules/#ffmpeg-installer/linux-x64/ffmpeg" and "/var/task/node_modules/#ffmpeg-installer/ffmpeg/node_modules/#ffmpeg-installer/linux-x64/ffmpeg"'
END RequestId: eb7906af-f46d-11e8-ae3b-45487c02a68e
REPORT RequestId: eb7906af-f46d-11e8-ae3b-45487c02a68e Duration: 38.73 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 19 MB
RequestId: eb7906af-f46d-11e8-ae3b-45487c02a68e Process exited before completing request
I had a kinda same issue with EC2, try this package.
Install the package
npm install --save #ffmpeg-installer/ffmpeg
In your code, use it as below
const ffmpegPath = require('#ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
I am new to phant and i cannot find a suitable documentation on phant using mongodb. because i have lots of data and it memory overflow occurs. and finally i fell into following error:
HTTP output: { [Error: EMFILE, open 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv']
errno: -24,
code: 'EMFILE',
path: 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv' }
events.js:87
throw Error('Uncaught, unspecified "error" event.');
^
Error: Uncaught, unspecified "error" event.
at Error (native)
at Function.emit (events.js:87:13)
at Function.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-manager-http/index.js:237:12)
at PhantMeta.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/lib/phant-meta-nedb.js:243:14)
at callback (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/executor.js:30:17)
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/datastore.js:536:25
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/persistence.js:201:12
at fs.js:1077:21
at FSReqWrap.oncomplete (fs.js:95:15)
except this sometimes following error also occurs:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
thats why i want to use mongodb to prevent this error. i searched about this and finally found sparckfun library for mongodb:
https://github.com/sparkfun/phant-stream-mongodb
i installed this but nothing happened as data still not string into mongo.
so, How will i store phant data into mongodb ?
I had the same problem, specifically trying to deploy my own Phant instance on Heroku (since I wanted to circumvent Sparkfun's 50Mb limit). After some dabbling with versions of the mongodb and mongoose libraries, I successfully forked and modified their repository so that you can either run it locally or directly deploy on heroku (just make sure you provision a MongoLab add-on). Check out my fork here: https://github.com/davidlago/phant
Hope this helps!