bagetter / BaGetter

A lightweight NuGet and symbol server
https://www.bagetter.com
MIT License
269 stars 57 forks source link

Symbols server page returning 404 #154

Open vh54 opened 5 months ago

vh54 commented 5 months ago

Describe the bug

I've uploaded a nupkg and a snupkg but I can't consult or autoload the symbols via the url in the documentation.

on page https://www.bagetter.com/docs/Installation/docker it is stated http:///api/download/symbols but it always returns 404

root@buildmachine:/root # dockerps
bagetter/bagetter:latest           bagetter                    Up 21 minutes  2024-06-12 16:58:56 +0200 CEST 0.0.0.0:4444->8080/tcp, :::4444->8080/tcp
√root@buildmachine:/root # curl http://localhost:4444/api/v2/symbol -kv
*   Trying 127.0.0.1:4444...
* Connected to localhost (127.0.0.1) port 4444 (#0)
> GET /api/v2/symbol HTTP/1.1
> Host: localhost:4444
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 0
< Date: Wed, 12 Jun 2024 13:26:21 GMT
< Server: Kestrel
<

To Reproduce

Steps to reproduce the behavior:

root@buildmachine:/agu/bagetter # find data
data
data/baget.db
data/packages
data/packages/packages
data/packages/packages/factsdataobjects
data/packages/packages/factsdataobjects/4.9.9
data/packages/packages/factsdataobjects/4.9.9/factsdataobjects.4.9.9.nupkg
data/packages/packages/factsdataobjects/4.9.9/factsdataobjects.nuspec
data/packages/symbols
data/packages/symbols/factsdataobjects.pdb
data/packages/symbols/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90ffffffff
root@buildmachine:/agu/bagetter # cat bagetter.yml
version: '3.8'

services:
  nuget-server:
    image: bagetter/bagetter:latest
    container_name: bagetter
    restart: unless-stopped
    ports:
      - "4444:8080"
    env_file:
      - bagetter.env
    environment:
      - BaseURL=https://bagetter.foo.com/
    volumes:
      - ./data:/data
root@buildmachine:/agu/bagetter # cat bagetter.env
# The following config is the API Key used to publish packages.
# You should change this to a secret value to secure your server.
ApiKey=foo
Storage__Type=FileSystem
Storage__Path=/data/packages
Database__Type=Sqlite
Database__ConnectionString=Data Source=/data/baget.db
Search__Type=Database
AllowPackageOverwrites=true
Symbols__Enabled=true 

Expected behavior

Not a 404 but a usefull where symbols could be looked up

Regenhardt commented 5 months ago

curl http://localhost:4444/api/v2/symbol will not work, there's no GET mapped to that endpoint.

In your case, what if you run curl http://localhost:4444/api/download/symbols/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90?

Will test this soon, just don't have the time right now.

vh54 commented 5 months ago

Thank you for your response. It does not return a result no. Here some curls

√root@buildmachine:/agu/bagetter # curl  http://localhost:4444/api/download/symbols/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90 -v
*   Trying 127.0.0.1:4444...
* Connected to localhost (127.0.0.1) port 4444 (#0)
> GET /api/download/symbols/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90 HTTP/1.1
> Host: localhost:4444
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 0
< Date: Thu, 13 Jun 2024 07:20:48 GMT
< Server: Kestrel
<
* Connection #0 to host localhost left intact
√root@buildmachine:/agu/bagetter # curl  http://localhost:4444/api/download/symbols/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90ffffffff -v
*   Trying 127.0.0.1:4444...
* Connected to localhost (127.0.0.1) port 4444 (#0)
> GET /api/download/symbols/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90ffffffff HTTP/1.1
> Host: localhost:4444
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 0
< Date: Thu, 13 Jun 2024 07:21:43 GMT
< Server: Kestrel
<
* Connection #0 to host localhost left intact
√root@buildmachine:/agu/bagetter # curl  http://localhost:4444/v3/symbol/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90 -v
*   Trying 127.0.0.1:4444...
* Connected to localhost (127.0.0.1) port 4444 (#0)
> GET /v3/symbol/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90 HTTP/1.1
> Host: localhost:4444
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 0
< Date: Thu, 13 Jun 2024 07:20:26 GMT
< Server: Kestrel
<
* Connection #0 to host localhost left intact
√root@buildmachine:/agu/bagetter # curl -o factsdataobjects.4.9.9.nupkg http://localhost:4444/v3/package/factsdataobjects/4.9.9/factsdataobjects.4.9.9.nupkg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  156k  100  156k    0     0  19.4M      0 --:--:-- --:--:-- --:--:-- 21.7M
√root@buildmachine:/agu/bagetter # curl  http://localhost:4444/api/download/symbols -v
*   Trying 127.0.0.1:4444...
* Connected to localhost (127.0.0.1) port 4444 (#0)
> GET /api/download/symbols HTTP/1.1
> Host: localhost:4444
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 0
< Date: Thu, 13 Jun 2024 07:21:56 GMT
< Server: Kestrel
<
* Connection #0 to host localhost left intact

My ultimate goal would be to have the url of symbol server in visual studio to it's possible to automatically download uploaded symbols:

image

mbaksh01 commented 1 month ago

Hi All 👋

I've been looking at this issue and I believe I have found the problem.

The endpoint from which you are trying to request the symbol packages does not exist. The correct path would be /api/download/symbols/factsdataobjects.pdb/7dc8b3ca5b174bd1a0a6400423cf5b90ffffffff/factsdataobjects.pdb.

Note: the additional factsdataobjects.pdb on the end is part of the NuGet Api Schema and is whats requested by Visual Studio

This can be seen in the following file: https://github.com/bagetter/BaGetter/blob/087ca2079acd76ff00db194140fb7f23c2247f23/src/BaGetter.Web/BaGetterEndpointBuilder.cs#L63

In terms of setting using this symbol server with Visual Studio you can do as follows:

image

I tested this on my PC and the pbd gets downloaded as expected.

Hope this helps 😄