Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment failing to validate with "Unexpected error validating environment" #639

Closed
3 tasks done
ikethecoder opened this issue Nov 18, 2022 · 1 comment · Fixed by #753
Closed
3 tasks done
Assignees
Labels
bug Something isn't working

Comments

@ikethecoder
Copy link
Member

API Services Portal Issue

User Story

As a API Provider,

I want to activate an environment

so that it appears on the API Directory.

Test Case

ENV

  • DEV
  • TEST
  • PROD

TESTCASE

  • Namespace has been assigned to an Organization by the APS team
  • Product and Dataset has been created and associated to each other
  • A Gateway Service and at least one Route has been created
  • Protect a "gateway route" with the jwt-keycloak plugin
  • Set the Product Environment Authorization field to 'OAuth2 Client Credential Flow'
  • Link the corresponding Gateway Service with the Environment
  • Check the "Enabled Environment" box

EXPECTED

  • The environment is enabled

ACTUAL

  • Get an error "Unexpected error validating environment"

ERROR

error: [wf.ValidateActiveEnv] Validation threw an exception TypeError: Cannot read properties of undefined (reading 'startsWith')
at /app/dist/services/workflow/validate-active-environment.js:121:153
at /app/dist/services/workflow/validate-active-environment.js:173:17
at Array.filter (<anonymous>)
at /app/dist/services/workflow/validate-active-environment.js:172:64
at Array.filter (<anonymous>)
at /app/dist/services/workflow/validate-active-environment.js:172:32
at Array.filter (<anonymous>)
at /app/dist/services/workflow/validate-active-environment.js:125:44
at Generator.next (<anonymous>)
at fulfilled (/app/dist/services/workflow/validate-active-environment.js:5:58)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
error: [general] GraphQL Error: You attempted to perform an invalid mutation

Notes

The plugin configuration for Gateway Routes are not getting parsed in the same way as the Gateway Service plugins, which results in an unexpected parsing check related to validation of the "well_known_template".

@ikethecoder ikethecoder added the bug Something isn't working label Nov 18, 2022
@ikethecoder
Copy link
Member Author

Example minimal gateway config:

services:
- name: a-service-for-anontest
  host: httpbin.org
  tags: [ ns.anontest ]
  port: 443
  protocol: https
  retries: 0
  routes:
  - name: a-service-for-anontest-route
    tags: [ ns.anontest ]
    hosts:
    - a-service-for-anontest.api.gov.bc.ca
    paths:
    - /
    methods:
    - GET
    strip_path: false
    https_redirect_status_code: 426
    path_handling: v0
    request_buffering: true
    response_buffering: true
    plugins:
    - name: jwt-keycloak
      tags: [ ns.anontest ]
      config:
        allowed_iss: [ "https://auth.service" ]
        well_known_template: "https://auth.service/.well-known/configuration"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant