Gitea: "Preview Changes" on web editor not working

Created on 28 Oct 2018  Â·  11Comments  Â·  Source: go-gitea/gitea

  • Gitea version (or commit ref): 1.6.0-rc1
  • Git version: 2.17.1
  • Operating system: Ubuntu Minimal 18.04
  • Database (use [x]):

    • [ ] PostgreSQL

    • [ ] MySQL

    • [ ] MSSQL

    • [x] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [ ] No

    • [ ] Not relevant

  • Log gist: Nothing unusual. But the post request returns this:

template: repo/diff/section_unified:1:11: executing "repo/diff/section_unified" at <.file>: can't evaluate field file in type *models.DiffFile

If no change is made to the files, it sucessfully shows "There are no changes to show.", but if something changes, it doesn't work (stuck on "Loading…"), and analyzing the POST request it returns the error above.

I tried:

  • Going back to gogs and test there. It works.
  • I use it behind a reverse proxy. So, I tried removing this, changing protocol to https and directly accessing it.
  • I upgraded from gogs. So I though this could be the problem and temporarly renamed the data/ folder and started new (except for app.conf).
  • Tried removing almost all modifications I made to the config.
  • Using version 1.6.

I'm out of ideas.

kinbug

Most helpful comment

@lunny Thanks for the tip, I found the problem in the config. :+1:

For anyone else with this problem, please note that the docs don't explain properly. If you are using docker, and you use ports 4000:3000 (for example) instead of the default 3000:3000, then this must be in the config:

ini HTTP_PORT = 3000 # internal docker port ROOT_URL = http://localhost:4000/ # external docker port

I thought they must both be equal to the internal docker port, but that is not correct. ROOT_URL must be set to the external docker port!

All 11 comments

Could you reproduce that on https://try.gitea.io ?

Tested now.
Yes. Using Firefox, IE and Edge on Windows. Same problem.
Tried on another computer too (Ubuntu, Firefox).

@alpe12 could you give a link where you tested on https://try.gitea.io ?

Just created this empty file and tried to edit it (and preview).
https://try.gitea.io/alpe12/test/_edit/master/testfile

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

This issue has been resolved.

Closed now and feel free to reopen it.

@lunny I also have this problem with dockerised gitea 1.9.1, ubuntu, sqlite, firefox latest.

It just says "Loading..." and doesn't show preview.

The console has this error:

Failed to load ‘http://localhost:3000/api/v1/repos/bob/techno/markdown’. A ServiceWorker passed a promise to FetchEvent.respondWith() that rejected with ‘TypeError: NetworkError when attempting to fetch resource.’.

And the suspicious thing is that gitea is running on a different port, not the 3000 shown above. And everything else works...

@lonix1 That should be your configuration's problem. You can go discord or discourse forum to discuss your problem.

@lunny Thanks for the tip, I found the problem in the config. :+1:

For anyone else with this problem, please note that the docs don't explain properly. If you are using docker, and you use ports 4000:3000 (for example) instead of the default 3000:3000, then this must be in the config:

ini HTTP_PORT = 3000 # internal docker port ROOT_URL = http://localhost:4000/ # external docker port

I thought they must both be equal to the internal docker port, but that is not correct. ROOT_URL must be set to the external docker port!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thehowl picture thehowl  Â·  3Comments

lunny picture lunny  Â·  3Comments

mirhec picture mirhec  Â·  3Comments

jonasfranz picture jonasfranz  Â·  3Comments

cookiengineer picture cookiengineer  Â·  3Comments