immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
45.08k stars 2.18k forks source link

[BUG] [Regression] External Library uploading using CLI not working #4091

Closed coxtor closed 1 year ago

coxtor commented 1 year ago

The bug

Adding an external library using the CLI is no longer functional as of discord discussion https://discord.com/channels/979116623879368755/1151645349522456668 , confirmed by @jrasm91 .

The connection to the server works fine: Bildschirmfoto_vom_2023-09-14_00-52-33

Dockercompose snippet: Docker-Compose for both server and microservices:

    volumes:
    ${UPLOAD_LOCATION}:/usr/src/app/upload
        /media/data/Bilder/:/media/data/Bilder/:ro

Docker Logs show now indication of an upload.

CLI Command: immich upload --recursive --import --key <key> --server http://192.168.178.97:3001 /media/data/Bilder/

CLI Error:

Error asset:  {
  file: '/media/data/Bilder/sortieren/einsortieren/pmliugebt0o0ao5prt1c7g1zdn1vasdggtmyxqs21rangswufh0govzv6jnybzow.jpg',
  reason: Error: Request failed with status code 400
      at createError (/usr/local/lib/node_modules/immich/node_modules/axios/lib/core/createError.js:16:15)
      at settle (/usr/local/lib/node_modules/immich/node_modules/axios/lib/core/settle.js:17:12)
      at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/immich/node_modules/axios/lib/adapters/http.js:322:11)
      at IncomingMessage.emit (node:events:526:35)
      at endReadableNT (node:internal/streams/readable:1359:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
    config: {
      transitional: [Object],
      adapter: [Function: httpAdapter],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: Infinity,
      maxBodyLength: Infinity,
      validateStatus: [Function: validateStatus],
      headers: [Object],
      method: 'post',
      maxRedirects: 0,
      url: 'http://192.168.178.97:3001/asset/import',
      data: '{"deviceAssetId":"pmliugebt0o0ao5prt1c7g1zdn1vasdggtmyxqs21rangswufh0govzv6jnybzow.jpg-26297","deviceId":"568faec6450e4a4288ff0e2ded6ab6c4","assetType":"IMAGE","fileCreatedAt":"2011-05-24T20:52:54.000Z","fileModifiedAt":"2011-05-24T20:52:54.000Z","isFavorite":"false","fileExtension":".jpg","duration":"0:00:00.000000","isReadOnly":"true","assetPath":"/media/data/Bilder/sortieren/einsortieren/pmliugebt0o0ao5prt1c7g1zdn1vasdggtmyxqs21rangswufh0govzv6jnybzow.jpg"}'
    },
    request: ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: true,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,   
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: 476,
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: true,
      socket: [Socket],
      _header: 'POST /asset/import HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' + 
        'x-api-key: \r\n' +
        'User-Agent: axios/0.26.1\r\n' +
        'Content-Length: 476\r\n' +
        'Host: 192.168.178.97:3001\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/asset/import',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: '192.168.178.97',
      protocol: 'http:',
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    response: {
      status: 400,
      statusText: 'Bad Request',
      headers: [Object],
      config: [Object],
      request: [ClientRequest],
      data: [Object]
    },
    isAxiosError: true,
    toJSON: [Function: toJSON]
  },
  response: {
    message: 'Unsupported file type /usr/src/app/mediadataBildersortiereneinsortierenpmliugebt0o0ao5prt1c7g1zdn1vasdggtmyxqs21rangswufh0govzv6jnybzowjpg',
    error: 'Bad Request',
    statusCode: 400
  }
}

The OS that Immich Server is running on

Docker

Version of Immich Server

1.78.0

Version of Immich Mobile App

1.78.0

Platform with the issue

Your docker-compose.yml content

-

Your .env content

-

Reproduction steps

1. upload external images using cli

Additional information

No response

scarpentier commented 1 year ago

Oh thank you I'm not the only one with this issue😅

aguiller31 commented 1 year ago

same

dacagi commented 1 year ago

Yes, this is also happening to me. I thought it was my fault because of using symlinked paths, but I can confirm it also fails when trying to import a single file without links or subfolders in the way. Uploading without the --import flag works fine.

scarpentier commented 1 year ago

Wow that was fast! 😲 Thanks a lot @alextran1502! 🥰