fsprojects / fsprojects/Paket

Private NuGet repository not accessible from fsx file (XmlException: Data at the root level is invalid)

Open
#4,021 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

I've deployed a Nexus repository and put a library in its Nuget repo. Now I'm trying to access this artifact from a fsx script but it is failing whereas I can get the artifact xml with curl.

Repro steps
  1. A failing fsx example (my artifacts in Nexus are accessible anonymously, you should be able to access it)
open System

open Fake.IO
#r "paket:
source https://packages.antvoice.com/repository/nuget-group/

nuget AntVoiceBuild 0.11.20210521.3 
//"
#load "./.fake/build.fsx/intellisense.fsx"

open IncrementalBuild

printfn "Hello world"
  1. Run the command dotnet fake run test.fsx
Expected behavior

The artifact is downloaded correctly

Actual behavior

Paket is failing with the following error :

There was a problem while setting up the environment:
-> Unable to retrieve package versions for 'AntVoiceBuild'
   -- CLOSED --
      
   -- OPEN ----
      AntVoiceBuild 0.11.20210521.3 (from /work/nodev/.fake/test.fsx/paket.dependencies)
-> One or more errors occurred. (One or more errors occurred. (Could not find versions for package AntVoiceBuild on https://packages.antvoice.com/repository/nuget-group. (Source 'https://packages.antvoice.com/repository/nuget-group' yielded no results (Request 'https://packages.antvoice.com/repository/nuget-group/FindPackagesById()?semVerLevel=2.0.0&id='AntVoiceBuild'' finished with error) (Request 'https://packages.antvoice.com/repository/nuget-group/Packages?semVerLevel=2.0.0&$filter=Id eq 'AntVoiceBuild'' finished with error))))
-> One or more errors occurred. (Could not find versions for package AntVoiceBuild on https://packages.antvoice.com/repository/nuget-group. (Source 'https://packages.antvoice.com/repository/nuget-group' yielded no results (Request 'https://packages.antvoice.com/repository/nuget-group/FindPackagesById()?semVerLevel=2.0.0&id='AntVoiceBuild'' finished with error) (Request 'https://packages.antvoice.com/repository/nuget-group/Packages?semVerLevel=2.0.0&$filter=Id eq 'AntVoiceBuild'' finished with error)))
-> Could not find versions for package AntVoiceBuild on https://packages.antvoice.com/repository/nuget-group. (Source 'https://packages.antvoice.com/repository/nuget-group' yielded no results (Request 'https://packages.antvoice.com/repository/nuget-group/FindPackagesById()?semVerLevel=2.0.0&id='AntVoiceBuild'' finished with error) (Request 'https://packages.antvoice.com/repository/nuget-group/Packages?semVerLevel=2.0.0&$filter=Id eq 'AntVoiceBuild'' finished with error))
-> Source 'https://packages.antvoice.com/repository/nuget-group' yielded no results (Request 'https://packages.antvoice.com/repository/nuget-group/FindPackagesById()?semVerLevel=2.0.0&id='AntVoiceBuild'' finished with error) (Request 'https://packages.antvoice.com/repository/nuget-group/Packages?semVerLevel=2.0.0&$filter=Id eq 'AntVoiceBuild'' finished with error)
	-  Request 'https://packages.antvoice.com/repository/nuget-group/FindPackagesById()?semVerLevel=2.0.0&id='AntVoiceBuild'' finished with error
	-> XmlException: Data at the root level is invalid. Line 1, position 1.
	-  Request 'https://packages.antvoice.com/repository/nuget-group/Packages?semVerLevel=2.0.0&$filter=Id eq 'AntVoiceBuild'' finished with error
	-> XmlException: Data at the root level is invalid. Line 1, position 1.

Additional information

If I run the following command I can get what seem to be a correctly formated XML :
curl -iX GET "https://packages.antvoice.com/repository/nuget-group/Packages?semVerLevel=2.0.0&$filter=tolower(Id)%20eq%20'antvoicebuild'"

Remark that I encoded the 2 spaces arround eq because if I don't, Nexus is complaining with

  <p><b>400.</b> <ins>That’s an error.</ins>
  <p>Your client has issued a malformed or illegal request.  <ins>That’s all we know.</ins>

Which could explain why Paket is failing to parse the XML.

When encoding the spaces, it gives :

HTTP/2 200 
date: Fri, 21 May 2021 11:31:45 GMT
server: Nexus/3.29.2-02 (OSS)
x-content-type-options: nosniff
content-security-policy: sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation
x-xss-protection: 1; mode=block
content-type: application/xml
content-length: 3007
via: 1.1 google
alt-svc: clear

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://packages.antvoice.com/repository/nuget-group/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Packages</title>
  <id>https://packages.antvoice.com/repository/nuget-group/Packages</id>
  <updated>2021-05-21T11:31:45.960Z</updated>
  <link rel="self" title="Packages" href="Packages"/>
  <m:count>0</m:count>
  <entry>
    <id>https://packages.antvoice.com/repository/nuget-group/Packages(Id='AntVoiceBuild',Version='0.11.20210521.3')</id>
    <title type="text">AntVoiceBuild</title>
    <summary type="text">Package Description</summary>
    <updated>2021-05-21T11:12:25.510Z</updated>
    <author>
      <name>AntVoiceBuild</name>
    </author>
    <link rel="edit-media" title="V2FeedPackage" href="Packages(Id='AntVoiceBuild',Version='0.11.20210521.3')/$value" />
    <link rel="edit" title="V2FeedPackage" href="Packages(Id='AntVoiceBuild',Version='0.11.20210521.3')" />
    <category term="NuGetGallery.V2FeedPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <content type="application/zip" src="https://packages.antvoice.com/repository/nuget-group/AntVoiceBuild/0.11.20210521.3" />
    <m:properties>
      <d:Version>0.11.20210521.3</d:Version>
      <d:Copyright m:null="true"></d:Copyright>
      <d:Created m:type="Edm.DateTime">2021-05-21T11:12:25.515Z</d:Created>
      <d:Dependencies>FSharp.Core:4.3.4:netstandard20|FSharp.Data:3.0.1:netstandard20|Google.Cloud.Storage.V1:2.3.0:netstandard20</d:Dependencies>
      <d:Description>Package Description</d:Description>
      <d:DownloadCount m:type="Edm.Int32">0</d:DownloadCount>
      <d:GalleryDetailsUrl m:null="true"></d:GalleryDetailsUrl>
      <d:IconUrl m:null="true"></d:IconUrl>
      <d:IsLatestVersion m:type="Edm.Boolean">true</d:IsLatestVersion>
      <d:IsAbsoluteLatestVersion m:type="Edm.Boolean">true</d:IsAbsoluteLatestVersion>
      <d:IsPrerelease m:type="Edm.Boolean">false</d:IsPrerelease>
      <d:Published m:type="Edm.DateTime">2021-05-21T11:12:25.515Z</d:Published>
      <d:Language m:null="true"></d:Language>
      <d:LicenseUrl m:null="true"></d:LicenseUrl>
      <d:PackageHash>e242MOXKjUKWmsS9/m4v4YYIapuAs+Rlk6uhdX0S/tcb4fu7eXURDFhR3jDy3eEn9Ti8M3+kOz7bRVTeDOexqw==</d:PackageHash>
      <d:PackageHashAlgorithm>SHA512</d:PackageHashAlgorithm>
      <d:PackageSize m:type="Edm.Int64">43931</d:PackageSize>
      <d:ProjectUrl m:null="true"></d:ProjectUrl>
      <d:ReportAbuseUrl m:null="true"></d:ReportAbuseUrl>
      <d:ReleaseNotes m:null="true"></d:ReleaseNotes>
      <d:RequireLicenseAcceptance m:type="Edm.Boolean">false</d:RequireLicenseAcceptance>
      <d:Tags m:null="true"></d:Tags>
      <d:Title>AntVoiceBuild</d:Title>
      <d:VersionDownloadCount m:type="Edm.Int32">0</d:VersionDownloadCount>
    </m:properties>
  </entry>
</feed>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the failing fsx example and run dotnet fake run test.fsx against the Nexus NuGet source. Inspect how Paket constructs requests to FindPackagesById() and Packages?semVerLevel=2.0.0, comparing them with the working curl request. Done means the package version is discovered and downloaded without the XmlException.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.