valheim-server-docker icon indicating copy to clipboard operation
valheim-server-docker copied to clipboard

time to time getting 403 on ValheimPlus

Open salsa2k opened this issue 2 years ago • 4 comments

Hey, sometimes when I have to restart my container, I'm getting 403 and the server gets stuck. Sometimes I have to wait 30 minutes, sometimes I have to wait 1 hour or even more.

I saw in another post someone mentioning that the API have a limit, but how come I'm reaching this limit, if I restarted the server once in the past 5 hours?

Here is my log:

Dec 14 17:38:32 supervisord: valheim-updater INFO - Valheim Server is already the latest version
Dec 14 17:38:32 supervisord: valheim-updater DEBUG - [47] - ValheimPlus is enabled - running updater
Dec 14 17:38:32 supervisord: valheim-updater c
Dec 14 17:38:32 supervisord: valheim-updater u
Dec 14 17:38:32 supervisord: valheim-updater r
Dec 14 17:38:32 supervisord: valheim-updater l
Dec 14 17:38:32 supervisord: valheim-updater :
Dec 14 17:38:32 supervisord: valheim-updater  
Dec 14 17:38:32 supervisord: valheim-updater (
Dec 14 17:38:32 supervisord: valheim-updater 2
Dec 14 17:38:32 supervisord: valheim-updater 2) The requested URL returned error: 403 
Dec 14 17:38:32 supervisord: valheim-updater FATAL - Error: could not retrieve ValheimPlus release info from Github API
Dec 14 17:38:32 supervisord: valheim-updater ERROR - Failed to run ValheimPlus updater - retrying later - check your networking and volume access permissions

And my docker-compose config:

version: "3"

services: 
  valheim:
    image: ghcr.io/lloesche/valheim-server
    cap_add:
      - sys_nice
    volumes: 
      - /mnt/appdata/valheim-server/config:/config
      - /mnt/appdata/valheim-server/data:/opt/valheim
    ports: 
      - 2456-2457:2456-2457/udp
      - 9001:9001/tcp
    environment:
      - SERVER_NAME=Valheim Server
      - WORLD_NAME=ValheimServer
      - SERVER_PASS=1234
      - SERVER_PUBLIC=false
      - TZ=America/Toronto
      - VALHEIM_PLUS=true
    restart: unless-stopped
    stop_grace_period: 2m
    deploy:
      resources:
        limits:
          cpus: '0.70'
          memory: 4GB
    networks:
      static:
        ipv4_address: 192.168.2.20
    dns:
     - 192.168.2.100

networks:
  static:
    external:
      name: br0

Thanks ;)

salsa2k avatar Dec 14 '22 22:12 salsa2k

403 is the http error code saying "Forbidden" as in you're currently not allowed to download this file. With Github this typically happens if you're above your request limit. Maybe you restarted the server too often which ran the update check a bunch of times? I'll look into the "getting stuck" part, that obviously shouldn't happen just because the API returns an error.

lloesche avatar Dec 22 '22 01:12 lloesche

I totally confirm it would be a great idea @lloesche Alternatively, we could use a personal access token through an environment variable to poll Github as an authenticated user ? Rate limit increases from 60 to 5000 as an authenticated user https://www.endorlabs.com/blog/how-to-get-the-most-out-of-github-api-rate-limits

shad-lp avatar Dec 30 '22 15:12 shad-lp

I am getting a 403 when trying to download Valheim Plus on a first time server start. How would I add github personal access token to a docker-compose?

njakes avatar Feb 03 '23 20:02 njakes

I am getting a 403 when trying to download Valheim Plus on a first time server start. How would I add github personal access token to a docker-compose?

I did it by using a command in the hooks and changing the content of the valheim-plus-updater script:

Set POST_BOOTSTRAP_HOOK to sed -i '/$VALHEIM_PLUS_RELEASE"/c\ if ! api_response=$(curl -sfSL "https://api.github.com/repos/$VALHEIM_PLUS_REPO/releases/$VALHEIM_PLUS_RELEASE" --header "Authorization: Bearer $GITHUB_ACCESS_TOKEN"); then' /usr/local/bin/valheim-plus-updater

I then added a new environment variable GITHUB_ACCESS_TOKEN to the compose file and set the token there.

Some more linux savy people might find errors in my sed command or have improvements...

Currently it's useless anyways, since valheim-plus is broken with the latest update appearantly.

Oct  4 23:39:36 supervisord: valheim-server ArgumentException: Undefined target method for patch method static System.Collections.Generic.IEnumerable<HarmonyLib.CodeInstruction> ValheimPlus.SE_Rested_GetNearbyPieces_Transpiler::Transpiler(System.Collections.Generic.IEnumerable<HarmonyLib.CodeInstruction> instructions)
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.PatchClassProcessor.PatchWithAttributes (System.Reflection.MethodBase& lastOriginal) [0x00047] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.PatchClassProcessor.Patch () [0x0006a] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server Rethrow as HarmonyException: Patching exception in method null
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.PatchClassProcessor.ReportException (System.Exception exception, System.Reflection.MethodBase original) [0x0006c] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.PatchClassProcessor.Patch () [0x00095] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.Harmony.<PatchAll>b__11_0 (System.Type type) [0x00007] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.CollectionExtensions.Do[T] (System.Collections.Generic.IEnumerable`1[T] sequence, System.Action`1[T] action) [0x00014] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.Harmony.PatchAll (System.Reflection.Assembly assembly) [0x00006] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server   at HarmonyLib.Harmony.PatchAll () [0x0001b] in <474744d65d8e460fa08cd5fd82b5d65f>:0 
Oct  4 23:39:36 supervisord: valheim-server   at ValheimPlus.ValheimPlusPlugin.Awake () [0x00048] in <7c2de1882abc413da7273413f1d1b902>:0 

HackXIt avatar Oct 04 '23 21:10 HackXIt