Topic on Talk:RESTBase/Installation

TiltedCerebellum (talkcontribs)

I'm struggling to get RESTBase working. I have parsoid set up and working fine on port 8000.

With RestBase I'm continuously getting the error:

{"type":"https://mediawiki.org/wiki/HyperSwitch/errors/not_found#route","title":"Not found.","method":"get","uri":"/my-site.wiki/v1/page/html/Main_Page"}

My mediawiki api is viewable at the path I set. Parsoid is accessible at 8000.

I tried changing all the instances of localhost to www.my-site.wiki. I've tried dropping the https and going with http, dropping the www. I'm at a bit of a loss for what I should try next. Some help would be greatly appreciated.


The docs say a route error suggests that the requested endpoint does not exist, but the page exists and the api path is correct.

Any idea on what I'm doing wrong? Or next steps for troubleshooting?

# RESTBase config for small wiki installs
#
# - sqlite backend
# - parsoid at http:localhost:8000
# - wiki at https://www.my-site.wiki/api.php
#
# Quick setup:
# - npm install
#   If you see errors about sqlite, you might have to `apt-get install
#   libsqlite3-dev`.
# - cp config.example.yaml config.yaml
# - double-check and possibly modify lines marked with XXX, then start restbase with
#
#   node server
#
# - If all went well, http://localhost:7231/localhost/v1/page/html/Main_Page
# should show your wiki's [[Main Page]].

services:
  - name: restbase
    module: hyperswitch
    conf:
      port: 7231
      salt: secret
      default_page_size: 125
      user_agent: RESTBase
      ui_name: RESTBase
      ui_url: https://www.mediawiki.org/wiki/RESTBase
      ui_title: RESTBase docs
      spec:
        x-request-filters:
          - path: lib/security_response_header_filter.js
          - path: lib/normalize_headers_filter.js
        x-sub-request-filters:
          - type: default
            name: http
            options:
              allow:
                - pattern: https://www.my-site.wiki/api.php
                  forward_headers: true
                - pattern: http://localhost:8000
                  forward_headers: true
                - pattern: /^https?:\/\//
        paths:
          /{domain:www.my-site.wiki}/{api:v1}:
            x-modules:
              - spec:
                  info:
                    version: 1.0.0
                    title: Wikimedia REST API
                    description: Welcome to your RESTBase API.
                  x-route-filters:
                    - path: ./lib/normalize_title_filter.js
                      options:
                        redirect_cache_control: 's-maxage=0, max-age=86400'
                  paths:
                    /page:
                      x-modules:
                        - path: v1/content.yaml
                          options:
                            response_cache_control: 's-maxage=0, max-age=86400'
                        - path: v1/common_schemas.yaml # Doesn't really matter where to mount it.
                    /transform:
                      x-modules:
                        - path: v1/transform.yaml

          /{domain:localhost}/{api:sys}:
            x-modules:
              - path: projects/proxy.yaml
                options:
                  backend_host_template: '{{"/{domain}/sys/legacy"}}'
              - spec:
                  paths:
                    /table:
                      x-modules:
                        - path: sys/table.js
                          options:
                            conf:
                              backend: sqlite
                              dbname: db.sqlite3
                              pool_idle_timeout: 20000
                              retry_delay: 250
                              retry_limit: 10
                              show_sql: false
                              storage_groups:
                                - name: local
                                  domains: /./
                    /legacy/key_value:
                      x-modules:
                        - path: sys/key_value.js
                    /legacy/page_revisions:
                      x-modules:
                        - path: sys/page_revisions.js
                    /post_data:
                      x-modules:
                        - path: sys/post_data.js
                    /action:
                      x-modules:
                        - path: sys/action.js
                          options:
                            # XXX Check API URL!
                            apiUriTemplate: https://www.my-site.wiki/api.php
                            # XXX Check the base RESTBase URI
                            baseUriTemplate: "{{'http://127.0.0.1:7231/{domain}/v1'}}"
                    /page_save:
                      x-modules:
                        - path: sys/page_save.js
                    /parsoid:
                      x-modules:
                        - path: sys/parsoid.js
                          options:
                            parsoidHost: http://localhost:8000
                            response_cache_control: 's-maxage=0, max-age=86400'

# Finally, a standard service-runner config.
info:
  name: restbase

logging:
  name: restbase
  level: info

Ciencia Al Poder (talkcontribs)

The log you posted reads: "uri":"/my-site.wiki/v1/page/html/Main_Page"


But in your config, the path reads: /{domain:www.my-site.wiki}/{api:v1}:

my-site.wiki is not the same as www.my-site.wiki, thus it doesn't match. You should change your config to match your actual domain.

TiltedCerebellum (talkcontribs)

My domain is at www.my-site.wiki, any attempt to use it without www redirects to www.my-site.wiki. I was testing any URL pattern that I could get to work and forgot to update it to the correct one in my initial post (when I test the URL with or without the www the result is the same error, that error is output at the testing URL).

When I change the url I'm using to test it to have the www I get the same error:

When I change the config to remove the www I get the same error:

{"type":"https://mediawiki.org/wiki/HyperSwitch/errors/not_found#route","title":"Not found.","method":"get","uri":"/www.my-site.wiki/v1/page/html/Main_Page"}
Reply to "Not_found#route"