EDIT: As answered below by Carlos, this was a bug with serverless-dynamodb-local version 0.2.23 (version as of this edit is 0.2.35). It has now been resolved and if you are experiencing a similar issue you should update your dependencies.
I had a working dev environment of an AWS Lambda function developed on the Serverless framework, using DynamoDB (plugins: serverless-offline, serverless-dynamodb-local . After deleting node_modules and reinstalling, I have lost the ability to start the development server, which I used to do with serverless offline start
serverless offline works properly, but if I try to run dynamodb locally it throws the following error:
Reference Error ----------------------------------------
options is not defined
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
ReferenceError: options is not defined
at BbPromise.resolve.then (/Users/pablo/Documents/myProject/node_modules/serverless-dynamodb-local/index.js:164:21)
From previous event:
at PluginManager.invoke (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/classes/PluginManager.js:236:22)
at PluginManager.run (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/classes/PluginManager.js:255:17)
at variables.populateService.then (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/Serverless.js:99:33)
at runCallback (timers.js:672:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
at Serverless.run (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/Users/pablo/.nvm/versions/node/v6.10.3/lib/node_modules/serverless/bin/serverless:39:50)
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: darwin
Node Version: 6.10.3
Serverless Version: 1.19.0
Oddly enough, if I go to localhost:8000/shell, the dynamodb shell is running.
has anyone had a similar problem?
So it turns it was an issue, registered and solved here: https://github.com/99xt/serverless-dynamodb-local/issues/120
You can download the version 0.2.24 by typing npm i serverless-dynamodb-local#0.2.24 --save-dev if you are using it as a development dependency.
First, add Serverless Offline to your project:
npm install serverless-offline --save-dev
Then inside your project's serverless.yml file add following entry to the plugins section: serverless-offline. If there is no plugin section you will need to add it to the file.
It should look something like this:
plugins:
- serverless-offline
You can check wether you have successfully installed the plugin by running the serverless command line:
serverless
the console should display Offline as one of the plugins now available in your Serverless project.
then In your project root run:
serverless offline start or sls offline start.
Reference link
For me, it was a very subtle detail. I had stage set as local. So, I had to put the following line in the custom section of serverless.yml file:
custom:
dynamodb:
stages:
- local
I tried the below and it resolved the issue for me
sls dynamodb install --localPath ./bin
Reference https://github.com/99xt/serverless-dynamodb-local/issues/210
serverless-dynamodb-local 0.2.35 worked for me
yarn remove serverless-dynamodb-local
yarn add serverless-dynamodb-local#0.2.35
sls dynamodb install
run command
sls dynamodb install --stage dev
Related
I reinstalled multiple times NPM and Node on my pc.
(npm version 7.4.3)
(node version v15.7.0)
I followed the procedure for configuring the Firebase CLI with:
npm install -g firebase-tools
and firebase init and firebase deploy and the configuration seems to work fine.
The problem I'm facing happens when I open the index.js file and I uncomment the stock helloWorld function which looks like this:
exports.helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info("Hello logs!", {structuredData: true});
response.send("Hello from Firebase!");
});
I run firebase deploy and I receive this error
functions[helloWorld(us-central1)]: Deployment error.
Build failed: Build error details not available. Please check the logs at https://console. {urlStuff}
Functions deploy had errors with the following functions:
helloWorld
To try redeploying those functions, run:
firebase deploy --only "functions:helloWorld"
To continue deploying other features (such as database), run:
firebase deploy --except functions
Error: Functions did not deploy properly.
I honestly don't know what to do now.
I tried multiple times to re install node and npm and re doing the Firebase CLI procedure but nothing seems to solve this problem, I still receive this Error when deploying.
The log error I receive is this :
textPayload: "ERROR: error fetching storage source: generic::unknown: retry budget exhausted (3 attempts): fetching gcs source: unpacking source from gcs: source fetch container exited with non-zero status: 1"
As suggested by this link provided by #Muthu Thavamani :
GCP Cloud Function - ERROR fetching storage source during build/deploy
Firebase CLI uses NodeJS version 12 while on my device I had version 15 installed.
Just use this guide to downgrade your version of NodeJS and everything works fine.
For me, it was because I was using an older version of Firebase CLI.
So I ran the upgrade command as suggested, and it worked.
sudo npm i -g firebase-tools
(My Node version is v15.6.0)
I had a similar problem and wasn't solved by changing node version. What I had to do is actually enter Container Repos and delete both worker & cache images. Then I got it running (using node v12.22.1 and npm v6.14.12).
It's much easier to find and fix issue by examining the actual logs by using this command to open the log
firebase functions:log
The specific issue will be visible there. I sometimes had error as simple as a missing packages in package.json
I wish they could show better info on the errors directly. but at least we can find them here.
I've cloned a fully functioning repo. The project is in Typescript and I'm adding some unit tests using mocha. The project uses NewRelic and when I run the project I get the following error:
PS C:\Users\ENV\Projects\Consumer> npm start run
> wss#0.0.0 start C:\Users\ENV\Projects\Consumer
> node --inspect=5858 -r ts-node/register ./src/index.ts "run"
Debugger listening on ws://127.0.0.1:5858/e7008339-7856-4a71-9f54-acfbb1cdd93f
For help, see: https://nodejs.org/en/docs/inspector
{"app_name":"Consumer","level":"info","message":"App is running on http://localhost:3000","label":"","timestamp":"2020-07-14T13:57:48.276Z"}
New Relic for Node.js halted startup due to an error:
Error: Failed to connect to collector
at onStartConnect (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\agent.js:237:18)
at retry (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\collector\api.js:110:14)
at onPreConnect (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\collector\api.js:162:14)
at Immediate.setImmediate (C:\Users\ENV\Projects\Consumer\node_modules\newrelic\lib\collector\parse-response.js:62:24)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
I've done npm install. On other devices this project works just fine, so maybe I need to configure something differently on my local? I'm not sure. Also the license is correct and has been checked. Might anyone have suggestions on why I may be having this error and what I can do to fix it? Thanks!
npm install only retrieves the New Relic agent module, but you need to add the configuration like application name, and, more importantly, your license key for New Relic.
You can find all the details here: https://docs.newrelic.com/docs/agents/nodejs-agent/installation-configuration/install-nodejs-agent
So this error message is a bit misleading; the 'halted startup' referenced here is only for the New Relic agent itself, your application should continue to boot normally.
That specific error should really only appear if you don't actually have a network connection, are you sure this device was online when this happened?
I had the same issue, I removed newrelic folder from nodemodules directory and re-installed newrelic npm install newrelic --save
This solved my issue.
I updated Brew then updated Node from 10.12.0 -> 13.8.0
Now, I get the following error when trying to deploy a Google Cloud Function
firebase deploy --only functions:createJWT
i functions: preparing functions directory for
uploading...
Error: Error parsing triggers: Failed to load gRPC binary module
because it was not installed for the current system Expected
directory: node-v79-darwin-x64-unknown Found:
[node-v64-darwin-x64-unknown] This problem can often be fixed by
running "npm rebuild" on the current system Original error: Cannot
find module
'/Users/.../cloud-functions/functions/node_modules/grpc/src/node/extension_binary/node-v79-darwin-x64-unknown/grpc_node.node'
Require stack:
- /Users/.../cloud-functions/functions/node_modules/grpc/src/grpc_extension.js
- /Users/.../cloud-functions/functions/node_modules/grpc/src/client_interceptors.js
- /Users/.../cloud-functions/functions/node_modules/grpc/src/client.js
- /Users/.../cloud-functions/functions/node_modules/grpc/index.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/common-grpc/src/service.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/common-grpc/src/operation.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/common-grpc/src/index.js
- /Users/.../cloud-functions/functions/node_modules/#google-cloud/logging/src/index.js
- /Users/.../cloud-functions/functions/index.js
- /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js
Try running "npm install" in your functions directory before
deploying.
Tried npm rebuild and npm install in my functions directory and nothing works
Furthermore...could this issue be due to the fact that GCF Node runtime enviroment is Node10 and I have installed Node13 on my machine? - according to these docs:
https://cloud.google.com/functions/docs/concepts/nodejs-10-runtime
I am struggling to revert back to Node10, have tried by running brew install node#10 and get this:
Then tried running the following command as per output above to symlink it to /usr/local but still no luck
echo 'export PATH="/usr/local/opt/node#10/bin:$PATH"' >> ~/.bash_profile
Searching around about this error, indeed, this seems that the problem is related to your system waiting for a version and founding another one - as per this part of the error.
Error: Error parsing triggers: Failed to load gRPC binary module because it was not installed for the current system Expected directory: node-v79-darwin-x64-unknown Found: [node-v64-darwin-x64-unknown]
There are some options that you can give it a try, besides trying the npm rebuild. Another option might be updating the package.json - as per this case solved here - that would return your npm version to an old one.
Besides that, on this question in the Community, there are a few solutions that helped other users, that I would recommend you to take a look at it: NodeJs Error - Failed to load gRPC binary module because it was not installed for the current system Expected directory?
Let me know if the information helped you!
Trying to deploy to an unsupported Google Function execution environment won't work. According to the google docs the current supported environments are Node8 and Node10(beta), re-installing Node10 worked for me.
Running firebase deploy or firebase deploy --only functions or firebase deploy --only functions:functionName gives me Error: An unexpected error has occurred.
Do not mark this question as duplicate because I have searched every single answer given to similar questions and NOTHING solved the problem. I have been using firebase cloud functions successfully last time about a month ago but yesterday I was adding a new function and when I tried to deploy it I got that error. Since then I have uninstalled/installed node maybe 5 times, versions 6.x, 8.x and latest 10.x, I have created new firebase projects, tried deploying "helloworld" function that comes when you initialize cloud functions and nothing has worked.
I download node from here (https://nodejs.org/en/download/), latest version 10.15.3.
I know that in cloud functions documentations (https://firebase.google.com/docs/functions/get-started) it says "Cloud Functions can run on either Node v6, or Node v8.", but Doug Stevenson (https://www.youtube.com/watch?v=DYfP-UIKxH0&list=PLl-K7zZEsYLkPZHe41m4jfAxUi0JjLgSM) uses v9.5.0 without problems in this tutorials and I have also tried with multiple v6 and v8 versions after it didn't work with v10 and same problem exists.
So after I download it in "D:\node" directory I can run these commands:
C:\Users\PC>node --version
v10.15.3
C:\Users\PC>npm --version
6.4.1
C:\Users\PC>npm version
{ npm: '6.4.1',
ares: '1.15.0',
cldr: '33.1',
http_parser: '2.8.0',
icu: '62.1',
modules: '64',
napi: '3',
nghttp2: '1.34.0',
node: '10.15.3',
openssl: '1.1.0j',
tz: '2018e',
unicode: '11.0',
uv: '1.23.2',
v8: '6.8.275.32-node.51',
zlib: '1.2.11' }
Installation has also added npm inside "C:\Users\PC\AppData\Roaming\npm" directory and environment variables for "C:\Users\PC\AppData\Roaming" and "D:\node"
Then I go to D:\node directory and run this command:
npm install -g firebase-tools
Then I check firebase version with this
D:\node>firebase --version
6.7.0
Then I do firebase login which shows that I am already logged in, I do firebase list which correctly shows my firebase projects.
Then I create empty folder newFunctions and run this command:
firebase init functions
I choose same project, typescript as language and wait for setup to complete,
import * as functions from 'firebase-functions';
// // Start writing Firebase Functions
// // https://firebase.google.com/docs/functions/typescript
//
export const helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
That is the default function created in index.ts file,
Then I change directory to newFunctions\functions and run this command just like Doug did in that video above:
npm install firebase-functions#latest firebase-admin#latest --save
It added node_modules folder inside functions directory.
Then i run firebase deploy (tried with firebase deploy --only functions also)
I get this:
While looking for answer I found that I can run command with more informations with --debug:
firebase deploy --debug --only functions
and I get this:
+ functions: functions folder uploaded successfully
[2019-04-22T13:44:45.305Z] TypeError: Cannot read property 'match' of undefined
at exports.getAppEngineLocation (C:\Users\PC\AppData\Roaming\npm\node_modules\firebase-tools\lib\functionsConfig.js:41:27)
at module.exports (C:\Users\PC\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\functions\release.js:83:29)
at _chain (C:\Users\PC\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:22:40)
at C:\Users\PC\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:69:16
at process._tickCallback (internal/process/next_tick.js:68:7)
Error: An unexpected error has occurred.
Some people who got similar error resolved problem by using node v6 which I also tried but got the same error.
I lost more than 10 hours trying to fix this problem which is not caused by me or my code.
Hey i'm not sure if you've got this sorted or not, but i'm just starting out with firebase and cloud functions and going through the tutorial, the very first deploy gave me this error.
I managed to get it working by downgrading my NPM following this post:
TypeError: Cannot read property 'wanted' of undefined:
For me, the issue was just that I forgot to cd into the functions folder before running firebase deploy
Can someone please advise - how to resolve this? This setup works fine locally on Windows 7 laptop, but fails on Windows 2008 server.
Here is the setup:
1. Using ASP.NET Core App and NodeServices on Windows Server 2008.
2. Installed Node.js and NPM on the server.
Logged in as one of the admin accounts "xyz". When I install a npm module - in this case, cypress test framework, it installs under the path:
C:\Users\xyz\AppData\Local
But when I run the application, it looks for the module under the path:
C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\
The application fails, complaining that the module is not found.
Things I tried so far:
1. Copied the cypress module directly from user localappdata folder to above location. Then it works.
2. Tried giving full path to the var cypress = require('cypress') - it finds the module, but whenever we try to use cypress, gives the same error.
3. Tried changing the nom prefix as well as cache location to the above path, but npm install cypress always installs under user's localappdata path only.
Any ideas on how to - either make the npm install, install the module at desired location. OR make the application look at the desired path?
Thanks a lot.
Here is the error:
An unhandled exception occurred while processing the request.
NodeInvocationException: No version of Cypress is installed in: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress
Please reinstall Cypress by running: cypress install
----------
Cypress executable not found at: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\Cypress.exe
----------
Platform: win32 (6.1.7601)
Cypress Version: 3.1.5
Error: No version of Cypress is installed in: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress
Please reinstall Cypress by running: cypress install
----------
Cypress executable not found at: C:\Windows\system32\config\systemprofile\AppData\Local\Cypress\Cache\3.1.5\Cypress\Cypress.exe
----------
Platform: win32 (6.1.7601)
Cypress Version: 3.1.5
at raise (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\errors.js:161:13)
From previous event:
at C:\inetpub\wwwroot\EmbeddedDashboard\node_modules\cypress\lib\errors.js:169:37
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:48:60
From previous event:
at checkExecutable (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:43:11)
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:213:12
at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
at Object.start (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\tasks\verify.js:212:6)
at Object.start (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\exec\run.js:130:19)
at C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\cypress.js:29:19
at _fileCreated (C:\inetpub\wwwroot\projectTest\node_modules\tmp\lib\tmp.js:246:7)
at FSReqWrap.oncomplete (fs.js:82:15)
From previous event:
at Object.run (C:\inetpub\wwwroot\projectTest\node_modules\cypress\lib\cypress.js:26:28)
at module.exports.cypress.run.then (C:\inetpub\wwwroot\projectTest\Scripts\RunTests.js:4:13)
at C:\Windows\TEMP\mecqsmig.e5o:166:18
at IncomingMessage.<anonymous> (C:\Windows\TEMP\mecqsmig.e5o:186:37)
at emitNone (events.js:67:13)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.InvokeExportAsync<T>(NodeInvocationInfo invocationInfo, CancellationToken cancellationToken)
Cypress uses cachedir to find the correct location to install Cypress into. C:\Windows\System32\config\systemprofile is the home folder of the SYSTEM user on Windows. Somehow, npm install is being executed as SYSTEM, not as your user. This would cause Cypress will attempt to install to SYSTEM's %APPDATA% directory, which is C:\Windows\System32\config\systemprofile.
This would make sense, according to the system requirements of Cypress:
Windows 7+, only 32bit binaries are provided for Windows.
I figured out how to resolve this. For some reason, when I run the application, even though it is configured to run under a service account, it still kept using the default system location for cache location.
You can configure the cache location of Cypress by setting an environment variable to your desired location. That resolved the issue for me. Here is the link to it: https://docs.cypress.io/guides/getting-started/installing-cypress.html#Binary-cache
Basically, you set a value to this environment variable CYPRESS_CACHE_FOLDER and you are set.
Hope this helps someone.