How to access logs on StdLib for my nodejs application - node.js

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.

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

How do I set up the logging for solana-test-validator?

I am following along here - https://docs.solana.com/developing/on-chain-programs/debugging
I have included this line in .bashrc
export RUST_LOG=solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=info,solana_bpf_loader=debug,solana_rbpf=debug
When I deploy a program to solana-test-validator and call the function the program completes sucessfully however the msg! calls in the rust program are not printing in the console.
I am getting command not found error for below. Do I have to configure the github cargo registry?
$RUST_LOG
solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=info,solana_bpf_loader=debug,solana_rbpf=debug: command not found
To see the msg! calls, you can use the solana logs tool, pointed at your local validator, by opening up another terminal and running:
solana logs --url localhost
Check out https://docs.solana.com/cli/usage#solana-logs for the full info on how to use it.

How do you deploy Nodejs using Zeit now?

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

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

Error: EPERM, operation not permitted with Node.js and Etherpad Lite

I'm attempting to get an Etherpad Lite site up and running with IIS on my computer before I upload it to Azure for Web Sites, but I get this error when I try (http://pastebin.com/4rZWbqix):
iisnode encountered an error when processing the request. HRESULT: 0x2
HTTP status: 500 HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because
system.webServer/iisnode/#devErrorsEnabled configuration setting is
'true'.
In addition to the log of stdout and stderr of the node.exe process,
consider using debugging and ETW traces to further diagnose the
problem.
The last 64k of the output generated by the node.exe process to stdout
and stderr is shown below: fs.js:520 return
binding.lstat(pathModule._makeLong(path));
^ Error: EPERM, operation not permitted 'C:\Users\Matthew'
at Object.fs.lstatSync (fs.js:520:18)
at Object.realpathSync (fs.js:1047:21)
at tryFile (module.js:142:15)
at Function.Module._findPath (module.js:181:18)
at Function.Module._resolveFilename (module.js:336:25)
at Function.Module._load (module.js:280:25)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
There is no fs.js file in Etherpad's directory, so I would assume that it's some part of Node.js that's having a problem. I'm new to Node.js, so any help would be appreciated.
EDIT 1: I'm currently looking into alternatives to Azure, and granting permissions to C:\Users\Matthew. But would it be possible to somehow modify fs.js to put a try/catch around binding.lstat?
EDIT 2: After playing around with it a little (adding the permissions worked!), I've gotten it to work. But now loading 127.0.0.1:81 returns:
iisnode encountered an error when processing the request. HRESULT: 0x2
HTTP status: 500 HTTP reason: Internal Server Error
You are receiving this HTTP 200 response because
system.webServer/iisnode/#devErrorsEnabled configuration setting is
'true'.
In addition to the log of stdout and stderr of the node.exe process,
consider using debugging and ETW traces to further diagnose the
problem.
The last 64k of the output generated by the node.exe process to stdout
and stderr is shown below:
[x1B][33m[2012-10-03 20:28:13.587] [WARN]
console - [x1B][39mNo settings file found. Continuing using defaults!
[x1B][32m[2012-10-03 20:28:14.338] [INFO] console - [x1B][39mInstalled
plugins:
It would seem like this isn't an error, since what's outputted is what's expected, but it seems to stop at plugins.formatPlugins().
Make sure the user identity associated with the IIS application pool running your node.js application has appropriate filesystem permissions to the location where you deployed your application (looks like c:\users\matthew in this case).
If you are running your app within the Default App Pool and using default IIS user, you should be able to grant necessary permissions with:
%systemdrive%\windows\system32\icacls.exe c:\users\matthew /grant IIS_IUSRS:(OI)(CI)F
Case
Error: EPERM, operation not permitted 'C:\Users\Matthew'
This error occour because the user IIS_IUSRS, does not have access to this folder C:\Users\Matthew
Resolution
You can put your application on a 'public folder', example: 'C:\Test\[yourapplication]' and gives access to user IIS_IUSRS only to this folder.
It is about permission on the folder 'C:\Users\Matthew'. Take ownership and give modify permissions.
I had the same issue, and when I tried to use the latest node version via
nvm use [some node version 10.12.0 in my case] it output that it succeed but when I run node -v it showed to me that actually I'm on a node of 8.
I solved that by login as second windows user (although they both admins and node installed on C:/) and there I use the nvm use 10.12.0 to replace the node version, and when I back login with current user it worked.
I wouldn't recommend Azure for hosting Etherpad Lite, we don't optimize for Microsoft's services, this includes Microsoft Windows. If it's an option please use linux to host your node instances, you will be much happier in my experience.

Resources