How do you deploy Nodejs using Zeit now? - node.js

I'm trying to deploy my back-end nodejs server ising now by Zeit
I installed it using the npm i -g now command
and I used the now command to deploy, but I'm getting this error:
Now CLI 17.1.1
Error! The content of "~\AppData\Roaming\now\Data\auth.json" is invalid. No `token` property found inside. Run `now login` to authorize.
I'm confused on what I did wrong, any suggestions?

I had to run the command:
now login
then it asks for my Zeit account info. Afterwards, I navigated to the directory where my server files are and used the command:
now
to innitiate and deploy the backend.
Once it was done, it gave me a URL which I can use to access the backend within my front-end code

Related

Google Cloud Run Second Flask Application - requirements.txt issue

I have a google cloud run flask application named "HelloWorld1" already up and running however i need to create a second flask application. I followed the below steps as per documentation:
1- On "Cloud Shell Editor" clicked "<>Cloud Code" --> "New Application" --> "Cloud Run Application Basic Cloud Run Application .."-->"Python (Flask): Cloud Run", provide and new folder and application is created.
2- When i try to run it using "Run on Cloud Run Emulator" i get the following error:
Starting to run the app using configuration 'Cloud Run: Run/Debug Locally' from .vscode/launch.json...
To view more detailed logs, go to Output channel : "Cloud Run: Run/Debug Locally - Detailed"
Dependency check started
Dependency check succeeded
Starting minikube, this may take a while...................................
minikube successfully started
The minikube profile 'cloud-run-dev-internal' has been scheduled to stop automatically after exiting Cloud Code. To disable this on future deployments, set autoStop to false in your launch configuration /home/mian/newapp/.vscode/launch.json
Update initiated
Update failed with error code DEVINIT_REGISTER_BUILD_DEPS
listing files: file pattern [requirements.txt] must match at least one file
Skaffold exited with code 1.
Cleaning up...
Finished clean up.
I tried following:
1- tried to create different type of application e.g django instead of flask however always getting the same error
2- tried to give full path of [requirements.txt] in docker settings, no luck.
Please if someone help me understanding why i am not able to run a second cloud run Flask app due to this error?
It's likely that your Dockerfile references the 'requirements.txt' file, but that file is not in your local directory. So, it gives the error that it's missing:
listing files: file pattern [requirements.txt] must match at least one file

/npm/bin/npm-cli.js: not found on Azure app service - node app

I am trying to deploy the nodejs app to Azure but I am getting the below error.
2021-07-08T10:22:38.234570707Z
/home/site/wwwroot/node_modules/.bin/npm: 1:
/home/site/wwwroot/node_modules/.bin/npm: ../npm/bin/npm-cli.js: not
found
2021-07-08T10:22:38.244796509Z npm info lifecycle express-typescript-starter#0.1.0~start: Failed to exec start script
This is the output I am seeing application logs on Azure.
App Service is the free plan with Node 14 as a runtime environment running on Linux. I have verified all the files, everything looking good.
Even I checked node modules as well. The folder is there but the error-specific file i.e inside node_module npm/bin/npm-cli.js. It is not there.
But it's not on my local as well and there it's working fine.
I am deploying through Github action.

node-windows permission Denied - and not requesting rights after compiling?

I am trying to install dynamically windows services from my electron app.
For that i am using the node module "node-windows".
This looks like this:
service = new Service({
name: 'Watcher',
description: 'Watcher',
script: 'Watcher.js',
env: {
name: "SettingsPath",
value: storage.getDataPath()
}
});
service.on('install',function(){
service.start();
});
service.install();
this works very well on my dev machine.
The app requests for permission to create the service and installs it smoothly.
My Problem
If i compile the app to an exe the app doesnt request me for permissions and print an error
Permission Denied. Requires administrative privileges.
The app creates the service exe successfully at that time and doesnt do anything more.
Ok, so i started the app with admin privileges for testing this behavior.
Nice, the app doesnt show any error, creates the service exe AND ahhhhhh installed the service NOT.
Questions
Why does the app no ​​longer ask for permissions when it is compiled?
Why isn't the service installed when the app is compiled?
If you need any additional information, write me a comment. And thanks for your time.
the path to the elevate.cmd in node-windows is incorrect for electron apps.
i have documented the way of trouble here
found some more problems to use the node-windows package:
cant use scripts from electron asar file (exclude files or diable
asar)
the executable path from the generated service config is wrong (its the packaged app executable, but must be node.exe or an equivalent executable)
service will only run on target system if node.js is installed, or you provide an equivalent

How to access logs on StdLib for my nodejs application

I have a node js application for a slack-bot deployed on StdLib for a slack-bot application that I created using the following tutorial: Build a serverless slack bot in 9 minutes with node js and stdlib
Now, everything is up and running, but I just want to see the logs of my application from StdLib.
I am already logged in as the authenticated user from my terminal and I am able to execute the command lib up dev successfully.
But, now when I try to view the logs using the command: lib logs dev, i get the following error:
Error: You must be signed in as a service's owner or be part of the service's team to to view logs for a service
Can anyone help me understand what i am doing wrong and how to access the dev logs from StdLib?
EDIT: I also tried logging in again by using lib login --email <my email> and then again tried lib logs dev, but it resulted in the same error as above.
Interestingly, even after logging in, if I do lib info dev, It gives me the error Error: Bad Request: "<my username>" does not have permission to access "dev"
So, in case someone else is stuck with the same...
I was able to figure this out by checking out the following documentation:
https://docs.stdlib.com/main/#/creating-services/logging
basically I need to give the username and the app name in a specific fashion as follows:
lib logs <my username>.<my app>[#dev]
The error mentioned was kind of confusing and I could not decipher what I was doing wrong based on the error.

Google App Engine Nodejs Error 409

I'm using a Node Express app with App Engine. Everything's been deploying fine, but I must have had an interrupted deployment because now when I try to deploy using this:
gcloud preview app deploy .
I get this:
Error 409: --- begin server output ---
Another transaction by user <username> is already in progress for app:
s~<appId>, version: 1. That user can undo the transaction with "appcfg
rollback".
--- end server output ---
ERROR: (gcloud.preview.app.deploy) Command failed with error code [1]
I can't find an appcfg file to rollback, nor any documentation about this issue for a node app.
You can use gcloud preview app deploy . --force
which will implicitly do a rollback (to clear the deploy lock) before attempting the deployment.
Use the appcfg.py rollback command.
Here, create a file as app.yaml and a directory WEB-INF in which there will be two files named as web.xml and appengine-web.xml.

Resources