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

runtime error: invalid memory address with specific OpenAPI specs #222

Open
aryeht opened this issue Oct 5, 2023 · 1 comment
Open

runtime error: invalid memory address with specific OpenAPI specs #222

aryeht opened this issue Oct 5, 2023 · 1 comment
Labels
bug Something isn't working dependency Issue is upstream in a dependency library

Comments

@aryeht
Copy link

aryeht commented Oct 5, 2023

Dear RESTiSH,

first of all thank you for providing the tool.

I tried to make API calls to the airbyte API.
And I get the runtime error below.

API specs: https://raw.githubusercontent.com/airbytehq/airbyte-platform/main/airbyte-api/src/main/openapi/api.yaml

Full details below.
Any info would be grealty appreciated.

Restish version and API configuration

$ restish --version
restish version dev-2023-10-04-15:31

# RESTiSH API configuration:
$ cat ~/.config/restish/apis.json 
{
  "$schema": "https://rest.sh/schemas/apis.json",
  "airbyte": {
    "base": "http://localhost:8006",
    "spec_files": ["https://github.com/airbytehq/airbyte-platform/raw/main/airbyte-api/src/main/openapi/api.yaml"],
    "profiles": {
      "default": {
        "auth": {
          "name": "http-basic",
          "params": {
            "password": "password",
            "username": "airbyte"
          }
        }
      }
    },
    "tls": {}
  }
}

try to consume the /health endpoint (operationId: getHealthCheck) fails:

$ restish airbyte getHealthCheck
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0xebd3e3]

goroutine 1 [running]:
github.com/pb33f/libopenapi/datamodel/low.GenerateHashString({0x0, 0x0})
        /home/tikal/go/pkg/mod/github.com/pb33f/libopenapi@v0.9.7/datamodel/low/extraction_functions.go:707 +0x83
github.com/pb33f/libopenapi/datamodel/low/base.(*Schema).Hash(0xc000542400)
        /home/tikal/go/pkg/mod/github.com/pb33f/libopenapi@v0.9.7/datamodel/low/base/schema.go:249 +0x18fb
github.com/danielgtaylor/restish/openapi.renderSchemaInternal(0xc0000d1680, {0x0, 0x0}, 0x1, 0x10304a0?)
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/openapi/schema.go:215 +0x202a
github.com/danielgtaylor/restish/openapi.renderSchema(...)
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/openapi/schema.go:56
github.com/danielgtaylor/restish/openapi.openapiOperation(_, {_, _}, _, _, _)
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/openapi/openapi.go:410 +0x1b56
github.com/danielgtaylor/restish/openapi.loadOpenAPI3({0x1444ed0, 0xc000119910}, 0x40?, 0xc0001b2d80, 0x101bca0?)
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/openapi/openapi.go:618 +0x16a5
github.com/danielgtaylor/restish/openapi.(*loader).Load(_, {{0xc00003ef18, 0x4}, {0x0, 0x0}, 0x0, {0xc00003ef1f, 0xe}, {0xc00003ef2d, 0x1}, ...}, ...)
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/openapi/openapi.go:803 +0x19c
github.com/danielgtaylor/restish/cli.load(_, {{0xc00003ef18, 0x4}, {0x0, 0x0}, 0x0, {0xc00003ef1f, 0xe}, {0xc00003ef2d, 0x1}, ...}, ...)
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/cli/api.go:81 +0xd8
github.com/danielgtaylor/restish/cli.Load({0xc00003ec78, 0x15}, 0xc000140300)
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/cli/api.go:180 +0x1c4b
github.com/danielgtaylor/restish/cli.Run()
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/cli/cli.go:821 +0xea6
main.main()
        /home/tikal/go/pkg/mod/github.com/danielgtaylor/restish@v0.19.0/main.go:40 +0x245


The corresponding curl command returns successfuly:

curl 'http://localhost:8006/health' \
  -H 'Authorization: Basic YWlyYnl0ZTpwYXNzd29yZA==' 

Successful operation
@danielgtaylor danielgtaylor added bug Something isn't working dependency Issue is upstream in a dependency library labels Oct 18, 2023
@lorenzo-dev1
Copy link

I have the same error. I tried to download v0.14.0 of restish and it worked with that version.

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

No branches or pull requests

3 participants