Yooooomi/your_spotify

ENOENT when trying to import full streaming data

Opened this issue · 0 comments

Describe the bug

When trying to import extended streaming data, the request returns error 500 and the following error

Error: ENOENT: no such file or directory, open '/tmp/imports/309e3a0c3a4d65b763b80e2c9435f1d8'

Expected behavior

Import to succeed

Additional context

Using NixOS module https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/web-apps/your_spotify.nix and running behind nginx proxy, with following config:

services.your_spotify = let
  domain = "fm.joinemm.dev";
in {
  enable = true;
  settings = {
    PORT = 8081;
    SPOTIFY_PUBLIC = "8e870cbcc8d54fb8ad1ae8c33878b7f6";
    CLIENT_ENDPOINT = "https://${domain}";
    API_ENDPOINT = "https://${domain}/api";
  };
  spotifySecretFile = config.sops.secrets.spotify_client_secret.path;
  enableLocalDB = true;
  nginxVirtualHost = domain;
};

services.nginx.virtualHosts = {
  "fm.joinemm.dev" = {
    extraConfig = ''
      client_max_body_size 500M;
    '';
    locations."/api/" = {
      proxyPass = "http://127.0.0.1:${toString config.services.your_spotify.settings.PORT}/";
      extraConfig = ''
        proxy_set_header X-Script-Name /api;
        proxy_pass_header Authorization;
      '';
    };
  };
};

Not sure if the bug is in the nix implementation or your_spotify itself, but essentially this is just running the package as a systemd service so it should work.

/tmp confirmed to exist. Manually creating /tmp/imports/ had no effect. Unable to create full directory in advance since the hash changes every time. Permissions of /tmp are drwxrwxrwt as they should.

Relevant logs:

Jul 31 06:48:17 apollo your_spotify-start[26443]: Error: ENOENT: no such file or directory, open '/tmp/imports/309e3a0c3a4d65b763b80e2c9435f1d8'
Jul 31 06:48:18 apollo your_spotify-start[26443]: POST /import/full-privacy 500 946.239 ms - 229