!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

204 Members
58 Servers

Load older messages


SenderMessageTime
10 Sep 2023
@lily:lily.flowersLily Foster Probably back to #nix:nixos.org , more people can help there and I'm technically on mobile (I just have buildNpmPackage set as a matrix keyword so you pinged me with that first message and I thought I'd weigh in) 17:10:37
@shaniag:matrix.orgshaniag Lily Foster: getting one error for the bot service 19:43:23
@shaniag:matrix.orgshaniag
Sep 10 21:37:38 server node[528332]: Error: Cannot find module 'discord.js'
19:43:28
@lily:lily.flowersLily FosterHow is your flake structured? You probably want the working directory as that of the built package, not the flake source directory19:44:49
@lily:lily.flowersLily FosterI noticed that earlier but forgot to mention it19:44:59
@shaniag:matrix.orgshaniag
In reply to @lily:lily.flowers
How is your flake structured? You probably want the working directory as that of the built package, not the flake source directory
bot = {
      url = "github:...";
      inputs.nixpkgs.follows = "nixpkgs";
    };
19:45:38
@lily:lily.flowersLily Foster You probably want something like WorkingDirectory = inputs.botflake.packages.${pkgs.system}.default 19:45:47
@shaniag:matrix.orgshaniagah ok19:45:58
@lily:lily.flowersLily Foster
In reply to @shaniag:matrix.org
bot = {
      url = "github:...";
      inputs.nixpkgs.follows = "nixpkgs";
    };
Yeah but the bot flake itself, I was meaning its outputs
19:46:14
@shaniag:matrix.orgshaniagoh yeah that makes sense what you are saying19:46:17
@shaniag:matrix.orgshaniag hmm, now getting "an invalid token was provided Lily Foster 19:56:49
@shaniag:matrix.orgshaniagprobably did something wrong19:56:52
@shaniag:matrix.orgshaniagwith passing that with systemd19:56:58
@shaniag:matrix.orgshaniag

There has to be some little mistake with these two lines:

ExecStart = "${pkgs.nodejs_20}/bin/node index.js --token=$CREDENTIALS_DIRECTORY/bot.token";
LoadCredential = "bot.token:/var/run/bot-token.txt";
20:03:43
@shaniag:matrix.orgshaniagthe token inside of that file is correct20:03:55
@lily:lily.flowersLily Foster
In reply to @shaniag:matrix.org
the token inside of that file is correct
So if you run it locally/manually with node index.js --token=/var/run/bot-token.txt it works?
20:07:16
@lily:lily.flowersLily Foster(Just to be 100% clear)20:07:23
@shaniag:matrix.orgshaniag
In reply to @lily:lily.flowers
So if you run it locally/manually with node index.js --token=/var/run/bot-token.txt it works?
Nope, it only works with the token in plain text (node index.js --token=23948u2cxjMMwkejrjdslsf), I thought that systemd stuff pastes the files contents there
20:08:10
@lily:lily.flowersLily FosterIt does not, it just puts the file where the service can read it (e.g. so you can have the service be able to read a privileged file that it wouldn't otherwise be able to)20:09:09
@lily:lily.flowersLily FosterAnd then you're passing in the file there20:09:19
@lily:lily.flowersLily Foster(Side note but programs args are visible by anyone on a linux system and are discouraged for secrets, but for single-user systems I suppose the threat is not great)20:10:08
@shaniag:matrix.orgshaniagokay, I will modify my code so it can take a path20:10:50
@lily:lily.flowersLily FosterOkay, sounds good!20:11:43
@lily:lily.flowersLily Foster
In reply to @shaniag:matrix.org
Nope, it only works with the token in plain text (node index.js --token=23948u2cxjMMwkejrjdslsf), I thought that systemd stuff pastes the files contents there
(Also that's not your actual token, right? I forget the format discord app tokens are in)
20:12:12
@shaniag:matrix.orgshaniag
In reply to @lily:lily.flowers
(Also that's not your actual token, right? I forget the format discord app tokens are in)
no, it is not lol
20:12:27
@lily:lily.flowersLily FosterOkay, good, just making sure because you never know 😅20:15:11
@lily:lily.flowersLily FosterAlso these channel logs are publicly available20:15:26
@lily:lily.flowersLily FosterAnd we've, uh, had at least one accidental token leak already in this room20:15:42
@shaniag:matrix.orgshaniag
In reply to @lily:lily.flowers
Okay, good, just making sure because you never know 😅
hmm, Error: ENOENT: no such file or directory, open '$CREDENTIALS_DIRECTORY/bot.token
20:18:21
@shaniag:matrix.orgshaniagbut it works locally20:18:25

Show newer messages


Back to Room ListRoom Version: 6