Open Stef-00012 opened 2 months ago
Hey it's very simple! Just use the same docker-compose.prod.yml but replace all liked.party with your domain. You'll also need CLIENT_ID and CLIENT_SECRET from Spotify API (just google it, it's easy), and also a random long string as SESSION_SECRET. Those 3 are env vars read from config/index.ts
I just setup the docker-compose.prod.yml to use my domain and set the 3 env vars, but it keeps crashing with an error related to the database, error: relation "credentials" does not exist
The full error:
spotify-liked-songs-bkp-worker | (node:1) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
spotify-liked-songs-bkp-worker | (Use `node --trace-warnings ...` to show where the warning was created)
spotify-liked-songs-bkp-db | 2024-09-04 10:47:06.105 UTC [66] ERROR: relation "credentials" does not exist at character 42
spotify-liked-songs-bkp-db | 2024-09-04 10:47:06.105 UTC [66] STATEMENT:
spotify-liked-songs-bkp-db | SELECT
spotify-liked-songs-bkp-db | *
spotify-liked-songs-bkp-db | FROM
spotify-liked-songs-bkp-db | credentials
spotify-liked-songs-bkp-db | WHERE
spotify-liked-songs-bkp-db | id NOT IN(
spotify-liked-songs-bkp-db | SELECT
spotify-liked-songs-bkp-db | credentials.id FROM runs
spotify-liked-songs-bkp-db | JOIN credentials ON runs.credentials_id = credentials.id
spotify-liked-songs-bkp-db | WHERE (runs.type = 'defaultPlaylistSync'
spotify-liked-songs-bkp-db | AND date > NOW() - INTERVAL '1 minute' * COALESCE((credentials.config ->> 'defaultPlaylistSyncInterval')::int4, 30))
spotify-liked-songs-bkp-db | OR runs.type = 'error' OR runs.type = 'revokedCredentials'
spotify-liked-songs-bkp-db | );
spotify-liked-songs-bkp-worker | /app/node_modules/pg-protocol/dist/parser.js:287
spotify-liked-songs-bkp-worker | const message = name === 'notice' ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name);
spotify-liked-songs-bkp-worker | ^
spotify-liked-songs-bkp-worker |
spotify-liked-songs-bkp-worker | error: relation "credentials" does not exist
spotify-liked-songs-bkp-worker | at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)
spotify-liked-songs-bkp-worker | at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
spotify-liked-songs-bkp-worker | at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
spotify-liked-songs-bkp-worker | at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)
spotify-liked-songs-bkp-worker | at Socket.emit (node:events:517:28)
spotify-liked-songs-bkp-worker | at Socket.emit (node:domain:489:12)
spotify-liked-songs-bkp-worker | at addChunk (node:internal/streams/readable:368:12)
spotify-liked-songs-bkp-worker | at readableAddChunk (node:internal/streams/readable:341:9)
spotify-liked-songs-bkp-worker | at Readable.push (node:internal/streams/readable:278:10)
spotify-liked-songs-bkp-worker | at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
spotify-liked-songs-bkp-worker | length: 110,
spotify-liked-songs-bkp-worker | severity: 'ERROR',
spotify-liked-songs-bkp-worker | code: '42P01',
spotify-liked-songs-bkp-worker | detail: undefined,
spotify-liked-songs-bkp-worker | hint: undefined,
spotify-liked-songs-bkp-worker | position: '42',
spotify-liked-songs-bkp-worker | internalPosition: undefined,
spotify-liked-songs-bkp-worker | internalQuery: undefined,
spotify-liked-songs-bkp-worker | where: undefined,
spotify-liked-songs-bkp-worker | schema: undefined,
spotify-liked-songs-bkp-worker | table: undefined,
spotify-liked-songs-bkp-worker | column: undefined,
spotify-liked-songs-bkp-worker | dataType: undefined,
spotify-liked-songs-bkp-worker | constraint: undefined,
spotify-liked-songs-bkp-worker | file: 'parse_relation.c',
spotify-liked-songs-bkp-worker | line: '1392',
spotify-liked-songs-bkp-worker | routine: 'parserOpenTable'
spotify-liked-songs-bkp-worker | }
spotify-liked-songs-bkp-worker |
spotify-liked-songs-bkp-worker | Node.js v18.20.4
spotify-liked-songs-bkp-worker exited with code 1
Oh yes sorry. You have to run the SQL code in the migrations director on the database container.
thanks, got it to work
By the way the main website https://liked.party seems to be offline, i get 502
Thanks for noticing man! Yep I should give some love to the project 😅 I suspect there are some issues regarding user input that break the background work
reopened cause i'm having an issue, sometimes it recreates the Liked Songs playlist and in console it logs
spotify-liked-songs-bkp-worker | !!! New sync run {
spotify-liked-songs-bkp-worker | id: 750479,
spotify-liked-songs-bkp-worker | access_token: 'BQBsvETdFq...',
spotify-liked-songs-bkp-worker | refresh_token: 'AQBvU8rkzc...',
spotify-liked-songs-bkp-worker | user_id: '313c4mw7yrey6idzfrhennointqi',
spotify-liked-songs-bkp-worker | config: { defaultPlaylistSyncInterval: 30 }
spotify-liked-songs-bkp-worker | }
spotify-liked-songs-bkp-worker | - Refreshing access token...
spotify-liked-songs-bkp-worker | - Fresh token obtained!
spotify-liked-songs-bkp-worker | - Updating access token on the database...
spotify-liked-songs-bkp-worker | - Getting liked songs...
spotify-liked-songs-bkp-worker | - Liked songs retrieved!
spotify-liked-songs-bkp-worker | - Syncing default playlist...
spotify-liked-songs-bkp-worker | - Getting all playlists...
spotify-liked-songs-bkp-worker | !!! No more sync runs 2024-09-15T07:29:48.659Z
spotify-liked-songs-bkp-worker | !!! Unknown error while running SpotifyApiCapturedError: SpotifyApiCapturedError
spotify-liked-songs-bkp-worker | at handleNotOkResponse (file:///app/libraries/spotify/index.js:75:19)
spotify-liked-songs-bkp-worker | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
spotify-liked-songs-bkp-worker | at async rateLimitHandledFetch (file:///app/libraries/spotify/index.js:123:13)
spotify-liked-songs-bkp-worker | at async _getAllPlaylists (file:///app/libraries/spotify/index.js:246:23)
spotify-liked-songs-bkp-worker | at async syncDefaultPlaylist (file:///app/libraries/spotify/index.js:255:23)
spotify-liked-songs-bkp-worker | at async defaultPlaylistSync (file:///app/worker/index.js:34:5)
spotify-liked-songs-bkp-worker | at async processJob (file:///app/worker/index.js:44:9)
spotify-liked-songs-bkp-worker | at async Promise.all (index 0)
spotify-liked-songs-bkp-worker | at async PromisePoolExecutor.drainActiveTasks (/app/node_modules/@supercharge/promise-pool/dist/promise-pool-executor.js:557:9)
spotify-liked-songs-bkp-worker | at async PromisePoolExecutor.drained (/app/node_modules/@supercharge/promise-pool/dist/promise-pool-executor.js:547:9)
what's wrong? in one of the previous logs i also saw a 404 request to the playlist endpoint
spotify-liked-songs-bkp-worker | - Syncing default playlist...
spotify-liked-songs-bkp-worker | - Getting all playlists...
spotify-liked-songs-bkp-worker | - Retrying request... { url: 'https://api.spotify.com/v1/me/playlists' }
spotify-liked-songs-bkp-worker | - Retrying request... { url: 'https://api.spotify.com/v1/me/playlists' }
spotify-liked-songs-bkp-worker | - Retrying request... { url: 'https://api.spotify.com/v1/me/playlists' }
spotify-liked-songs-bkp-worker | - Retrying request... { url: 'https://api.spotify.com/v1/me/playlists' }
spotify-liked-songs-bkp-worker | - Retrying request... { url: 'https://api.spotify.com/v1/me/playlists' }
spotify-liked-songs-bkp-worker | !!!!!!! Unexpected erroneous response
spotify-liked-songs-bkp-worker | Error: SpotifyApiCapturedError
spotify-liked-songs-bkp-worker | URL: https://api.spotify.com/v1/me/playlists,
spotify-liked-songs-bkp-worker | Status: 404,
spotify-liked-songs-bkp-worker | StatusText: Not Found,
spotify-liked-songs-bkp-worker | Body: {"error": {"status": 404, "message": "Resource not found" } }
spotify-liked-songs-bkp-worker |
spotify-liked-songs-bkp-worker | Sentry not initialized
spotify-liked-songs-bkp-worker | !!! Unknown error while running SpotifyApiCapturedError: SpotifyApiCapturedError
spotify-liked-songs-bkp-worker | at handleNotOkResponse (file:///app/libraries/spotify/index.js:75:19)
spotify-liked-songs-bkp-worker | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
spotify-liked-songs-bkp-worker | at async rateLimitHandledFetch (file:///app/libraries/spotify/index.js:123:13)
spotify-liked-songs-bkp-worker | at async _getAllPlaylists (file:///app/libraries/spotify/index.js:246:23)
spotify-liked-songs-bkp-worker | at async syncDefaultPlaylist (file:///app/libraries/spotify/index.js:255:23)
spotify-liked-songs-bkp-worker | at async defaultPlaylistSync (file:///app/worker/index.js:34:5)
spotify-liked-songs-bkp-worker | at async processJob (file:///app/worker/index.js:44:9)
spotify-liked-songs-bkp-worker | at async Promise.all (index 0)
spotify-liked-songs-bkp-worker | at async PromisePoolExecutor.drainActiveTasks (/app/node_modules/@supercharge/promise-pool/dist/promise-pool-executor.js:557:9)
spotify-liked-songs-bkp-worker | at async PromisePoolExecutor.drained (/app/node_modules/@supercharge/promise-pool/dist/promise-pool-executor.js:547:9)
Spotify API just randomly throws errors here and there. Sometimes it works after a retry, but other times (mostly 500 errors) just doesn't work and there is no understandable reason for it haha.
would it be possible for you to make a guide on selfhosting it?