question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publishing Results Using URI Sources Fails (Link/Resource was not found)

See original GitHub issue

Following on from Issue #392 (Support Publishing Results Using URI Sources). I’m still not getting publishing working on PactUrl set by the Pact Broker webhook.

When the contract verification fails I see the following log

Publishing of verification results failed with an error: Link/Resource was not found - Request to pact broker path '/pacticipants/MYPROVIDER' failed: 404 Not Found. URL: <url to contract in pact broker>

When the contract verification passes I don’t see the logs the same way.

Trying that <url to contract in pact broker> I get:

{
  "consumer": {
    "name": "MYCONSUMER"
  },
  "provider": {
    "name": "MYPROVIDER"
  },
  "interactions": [
    <omitted for brevity>
  ],
  "metadata": {
    "pactSpecification": {
      "version": "2.0.0"
    }
  },
  "createdAt": "2022-07-15T13:28:47+00:00",
  "_links": {
    "self": {
      "title": "Pact",
      "name": "Pact between MYCONSUMER (1.1.3) and MYPROVIDER",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/version/1.1.3"
    },
    "pb:consumer": {
      "title": "Consumer",
      "name": "MYCONSUMER",
      "href": "<base path obscured>/pacticipants/MYCONSUMER"
    },
    "pb:consumer-version": {
      "title": "Consumer version",
      "name": "1.1.3",
      "href": "<base path obscured>/pacticipants/MYCONSUMER/versions/1.1.3"
    },
    "pb:consumer-versions": [
      {
        "title": "Consumer version",
        "name": "1.1.3",
        "href": "<base path obscured>/pacticipants/MYCONSUMER/versions/1.1.3"
      }
    ],
    "pb:provider": {
      "title": "Provider",
      "name": "MYPROVIDER",
      "href": "<base path obscured>/pacticipants/MYCONSUMER"
    },
    "pb:pact-version": {
      "title": "Pact content version permalink",
      "name": "0656cbf895ccf67d21811d64d586dfe812572362",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/pact-version/0656cbf895ccf67d21811d64d586dfe812572362"
    },
    "pb:latest-pact-version": {
      "title": "Latest version of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/latest"
    },
    "pb:all-pact-versions": {
      "title": "All versions of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/versions"
    },
    "pb:latest-untagged-pact-version": {
      "title": "Latest untagged version of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/latest-untagged"
    },
    "pb:latest-tagged-pact-version": {
      "title": "Latest tagged version of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/latest/{tag}",
      "templated": true
    },
    "pb:previous-distinct": {
      "title": "Previous distinct version of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/version/1.1.3/previous-distinct"
    },
    "pb:diff-previous-distinct": {
      "title": "Diff with previous distinct version of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/version/1.1.3/diff/previous-distinct"
    },
    "pb:diff": {
      "title": "Diff with another specified version of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/pact-version/0656cbf895ccf67d21811d64d586dfe812572362/diff/pact-version/{pactVersion}",
      "templated": true
    },
    "pb:pact-webhooks": {
      "title": "Webhooks for the pact between MYCONSUMER and MYPROVIDER",
      "href": "<base path obscured>/webhooks/provider/MYPROVIDER/consumer/MYCONSUMER"
    },
    "pb:consumer-webhooks": {
      "title": "Webhooks for all pacts with provider MYPROVIDER",
      "href": "<base path obscured>/webhooks/consumer/MYPROVIDER"
    },
    "pb:tag-prod-version": {
      "title": "PUT to this resource to tag this consumer version as 'production'",
      "href": "<base path obscured>/pacticipants/MYCONSUMER/versions/1.1.3/tags/prod"
    },
    "pb:tag-version": {
      "title": "PUT to this resource to tag this consumer version",
      "href": "<base path obscured>/pacticipants/MYCONSUMER/versions/1.1.3/tags/{tag}"
    },
    "pb:publish-verification-results": {
      "title": "Publish verification results",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/pact-version/0656cbf895ccf67d21811d64d586dfe812572362/metadata/Y3ZuPTEuMS4zJnc9dHJ1ZQ/verification-results"
    },
    "pb:latest-verification-results": {
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/pact-version/0656cbf895ccf67d21811d64d586dfe812572362/verification-results/latest"
    },
    "pb:triggered-webhooks": {
      "title": "Webhooks triggered by the publication of this pact",
      "href": "<base path obscured>/pacts/provider/MYPROVIDER/consumer/MYCONSUMER/version/1.1.3/triggered-webhooks"
    },
    "pb:matrix-for-consumer-version": {
      "title": "View matrix rows for the consumer version to which this pact belongs",
      "href": "<base path obscured>/matrix?q[][pacticipant]=MYCONSUMER&q[][version]=1.1.3&latestby=cvpv"
    },
    "curies": [
      {
        "name": "pb",
        "href": "<base path obscured>/doc/{rel}?context=pact",
        "templated": true
      }
    ]
  }
}

My code:

var pactVerifier = new PactVerifier(config)
    .ServiceProvider(_pactOptions.ProviderName, ServerAddress);

IPactVerifierSource pactVerifierWithSource;

// when verification triggered by consumer contract changed webhook
if (_pactOptions.IsVerifyingSpecificPact) 
{
    pactVerifierWithSource = pactVerifier.WithUriSource(new Uri(_pactOptions.PactUrl!), options =>
    {
        options.BasicAuthentication(_pactOptions.BrokerUsername, _pactOptions.BrokerPassword);
        options.PublishResults(_pactOptions.ShouldPublishResults, _pactOptions.ProviderVersion,
            publishOptions => { publishOptions.ProviderBranch(_pactOptions.ProviderBranch); });
    });
}
// when triggered by testing provider
else 
{
    pactVerifierWithSource = pactVerifier.WithPactBrokerSource(new Uri(_pactOptions.BrokerBaseUrl!),
        options =>
        {
            options.BasicAuthentication(_pactOptions.BrokerUsername, _pactOptions.BrokerPassword);
            options.EnablePending();
            options.ConsumerVersionSelectors(
                new ConsumerVersionSelector { Environment = "test" },
                new ConsumerVersionSelector { Branch = "dev" });  
            options.PublishResults(_pactOptions.ShouldPublishResults, _pactOptions.ProviderVersion,
                publishOptions => { publishOptions.ProviderBranch(_pactOptions.ProviderBranch); });
        });
}

// Act / Assert
pactVerifierWithSource
    .WithSslVerificationDisabled()
    .WithProviderStateUrl(new Uri(ServerAddress, "/providerStates"))
    .Verify();

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
rholshausencommented, Sep 7, 2022

I’ve released Pact FFI Library 0.3.11 with a fix for this

0reactions
adamrodgercommented, Sep 11, 2022

Fixed in #418

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support Publishing Results Using URI Sources · Issue #392
Publishing of verification results failed with an error: Link/Resource was not found - Request to pact broker path ...
Read more >
Cannot create the link resource from the given URI
"Cannot create the link resource from the given URI." The Mac switches to InDesign, but no image is placed. Workarounds are very cumbersome...
Read more >
Linked Resource Image not showing on Android EMail ...
I have them working on desktop Thunderbird and Outlook, but Android Email shows a broken image. I know it can work, because an...
Read more >
Resource not found errors - Azure Resource Manager
Describes how to resolve errors when a resource can't be found. The error might occur when you deploy a Bicep file or Azure...
Read more >
Azure PowerShell release notes
Learn about all of the latest updates to the Azure PowerShell modules.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found