Coder Social home page Coder Social logo

Master CI Fails about pygeoapi HOT 1 CLOSED

webb-ben avatar webb-ben commented on July 18, 2024
Master CI Fails

from pygeoapi.

Comments (1)

ricardogsilva avatar ricardogsilva commented on July 18, 2024

Hi @webb-ben

I've been looking into this and, while I do think it would be generally a good idea to have pygeoapi dependencies be pinned, in this particular case I believe the better solution is for us to simply update the pygeoapi tests - and have the discussion about dependency pinning some other time 😉

Looking at startlette's release notes, the only relevant change that concerns this pygeoapi CI breakage seems to be the mention to a change to the starlette test client.

The failing pygeoapi tests are using a configuration that features:

# snippet of pygeoapi/tests/pygeoapi-test-config-apirules.yml

server:
  url: http://localhost:5000/api

  # rest of config omitted for brevity

  api_rules:
    strict_slashes: true
    url_prefix: 'v{api_major}'
    version_header: 'X-API-Version'

This causes the pygeoapi tests to initialize a starlette TestClient by providing it a base URL of http://localhost:5000/api, which is the cause of the problem.

The server.url config value is supposed to be pygeoapi's public URL, but the pygeoapi web application is always served at the root path (i.e. /).

This means that when the public URL is modified with some additional path, as in the testing case, there must be some additional entity (usually a proxying web server) which takes care of reading the original URL (http://localhost:5000/api/v0/ and strip away the subpath before passing it down to pygeoapi, which only understands http://localhost:5000/v0/ (note the lack of the /api, sub-path).

The starlette test client, not being a proxy web server, is not able to perform such sub-path stripping. Therefore, the pygeoapi initialization of the test client should not be passing it the server's public base URL. I believe the reason why this was working before the recent change in starlette was due to this issue:

encode/starlette#2306

Which is what motivated the starlette change.

So in conclusion, the fix for this specific problem boils down to not passing a base_url when initializing the startlette test client - I am able to submit a PR with it shortly.

from pygeoapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.