christophenne / trello2planka

MIT License
15 stars 1 forks source link

Unexpected token 'I', "Internal S"... is not valid JSON #30

Closed colonyshipforsale closed 8 months ago

colonyshipforsale commented 9 months ago

Hello,

i am using a planka (dockerized) and trello2planka on the same host. The board was created as well as the first card, hoewever it seems that it fails, while adding the cover picture to this first card (first attachment) upload. Error below, please let me know if I should provide anymore info? Thank you! kr

node: v20.11.0 os: debian buster planka: 1.15.4 (edit)

npm run import-board -- --file=trello-export.json

...
authenticated POST to http://localhost:3000/api/boards/1169626018739127538/labels
status =  200
authenticated POST to http://localhost:3000/api/boards/1169626018739127538/labels
status =  200
authenticated POST to http://localhost:3000/api/boards/1169626018739127538/lists
status =  200
authenticated POST to http://localhost:3000/api/lists/1169626020987274492/cards
status =  200
fetching attachment from Trello API, path =  https://api.trello.com/1/cards/5edcb47b8f1dc70c77ac128a/attachments/5edcb4b6555550654c584d4c/download/image.png
status =  200
authenticated POST with file upload to http://localhost:3000/api/cards/1169626021247321341/attachments
SyntaxError: Unexpected token 'I', "Internal S"... is not valid JSON
    at JSON.parse (<anonymous>)
    at Response.json (file:///home/trelloimport/trello2planka/node_modules/node-fetch/src/body.js:149:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async authenticatedPostFileUpload (file:///home/trelloimport/trello2planka/src/planka/client.js:87:36)
    at async createAttachment (file:///home/trelloimport/trello2planka/src/planka/client.js:60:61)
    at async importAttachments (file:///home/trelloimport/trello2planka/src/planka/import.js:141:34)
    at async importCards (file:///home/trelloimport/trello2planka/src/planka/import.js:95:9)
    at async importLists (file:///home/trelloimport/trello2planka/src/planka/import.js:77:9)
    at async importTrelloBoard (file:///home/trelloimport/trello2planka/src/planka/import.js:18:5)
    at async main (file:///home/trelloimport/trello2planka/src/index.js:8:9)
christophenne commented 9 months ago

Hi,

did you have a look at the server logs? It seems to me that the server returns 500 Internal Server Error at this one request, would be interesting to see why.

I just double-checked, and the import still works with planka version 1.15.4 with the provided sample board.

colonyshipforsale commented 9 months ago

Yes thanks, planka logs gave a 500 permission denied as you said.

I used the planka admin user and checked the credentials in config.json.

I created a different admin user in planka > retried > same error. Then added the user to the project > retried > same error.

any ideas?

postgres_1  | 2024-01-31 15:11:09.700 UTC [21] LOG:  database system was shut down at 2024-01-31 15:10:10 UTC
postgres_1  | 2024-01-31 15:11:09.705 UTC [1] LOG:  database system is ready to accept connections
planka_1    | debug: Detected Sails environment is "production", but NODE_ENV is `undefined`.
planka_1    | debug: Automatically setting the NODE_ENV environment variable to "production".
planka_1    | debug:
planka_1    | 2024-01-31 15:11:21 [E] Sending 500 ("Server Error") response:
planka_1    |  EACCES: permission denied, mkdir '/app/private/attachments/c1f06fe4-59eb-4bb4-b125-e58fadb9a48b'
christophenne commented 9 months ago

Interesting, do any other attachments work via the Planka UI? For example uploading some file to a card manually. My guess is that this doesn't work either.

I assume that this attachments directory is mounted from the host machine - if so, I remember there is sometimes trouble in writing to those - hopefully this issue helps: https://github.com/plankanban/planka/issues/488

colonyshipforsale commented 8 months ago

Thank you for the hint! I tried the chown fix (it did not work) as i did no use mount points but docker volumes (standard docker compose file from planka) Would you suggest i open a new issue at planka?

edit: by copying the planka data out of the volumes to the filesystem and then restarting planka with those mountpoints and doing the chown solution mentioned in https://github.com/plankanban/planka/issues/488 it has worked!

However it should have worked with the standard planka volume based compose file? So still i would raise the issue there again but what is the proper etiquette? Close this one and reopen a new one @ planka issues?

version: '3'

services:
  planka:
    image: ghcr.io/plankanban/planka:latest
    command: >
      bash -c
        "for i in `seq 1 30`; do
          ./start.sh &&
          s=$$? && break || s=$$?;
          echo \"Tried $$i times. Waiting 5 seconds...\";
          sleep 5;
        done; (exit $$s)"
    restart: unless-stopped
    volumes:
      - user-avatars:/app/public/user-avatars
      - project-background-images:/app/public/project-background-images
      - attachments:/app/private/attachments
    ports:
      - 3000:1337
    environment:
      - BASE_URL=http://planka.localdomain:3000
      - TRUST_PROXY=0
      - DATABASE_URL=postgresql://postgres@postgres/planka
      - SECRET_KEY=xyz
    depends_on:
      - postgres

  postgres:
    image: postgres:14-alpine
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust

volumes:
  user-avatars:
  project-background-images:
  attachments:
  db-data:
christophenne commented 8 months ago

Nice!

Close this one and reopen a new one @ planka issues?

Yes, if the import has worked for you now, you can close this one (or let me know otherwise) and ask about the volume mounting in the planka repo, I think they can provide better answers there. Thanks!