Multiselect + API + Local Dev

Hey!

I trying to use a multiselect with options from an API endpoint, but I am having some problems with my setup. The part of the blueprints looks like this:

pageAccess:
  label: Page Access
  type: multiselect
  options: api
  api: "{{ site.url }}/api/kommunity/page-access-types"

I have a MAMP Pro setup using local dns for .test domains, server running on port 8890, Kirby 3.5.7.1. When I am in the panel the field throws the following error:

Could not resolve: kommunity.test (Domain name not found) in file: /PATH/TO/MY/KIRBY/INSTALL/kirby/src/Http/Remote.php line: 281

So I thought that might be some kind of issue with the dns setup I use and switched the host to use /etc/hosts instead. Which leads to another error message:

SSL certificate problem: unable to get local issuer certificate in file: /PATH/TO/MY/KIRBY/INSTALL/kirby/src/Http/Remote.php line: 281

The API endpoint is provided by my plugin. Querying the endpoint with postman works without any problems.

To be honest, I don’t really know what to do or where to hook in, I hope someone here can give me a hint :slight_smile:

So, I got one step ahead reading this: cURL error 6: Could not resolve: site.test (Domain name not found) · Issue #736 · laravel/valet · GitHub

So the domain not found problem is solved as soon as I add 127.0.0.1 as dns in the mac os settings (for some kind of reason curl/guzzle seems to need this setting, everything else works without)

Now I am still stuck with the ssl problem.

I guess, I have the same problem as described here: SSL certificate problem with select panelfield api option - #3 by marsupial

I tried disabling CA like so:

'remote' => [
        'ca' => false
]

but it doesn’t seem to work either, am I doing something wrong?

This is strange. Can you assure yourself that this option is recognized?

Does the error message change?

Do you get more error messages if you set Kirby’s debug option to true?

What kind of certificate are you using for kommunity.test?

What if using http instead of https (as long as you are on your local machine)?

1 Like

Dumping out the option returns the correct value. So at least it is set correctly, I guess.
The error msg didn’t change after setting the ca option to false.
Those are self signed certs, created by mamp.

I found a solution, which is at least working for me. I already use a config option to enable API mocks for local dev/testing and will now also use it to init the guzzle client this way:

new Client([
    'verify' => false
]);

This ignores the ssl issues and I can work locally.

Of course it would be better to really solve this issue, but for now it’s working and I can take the time and investigate what might be wrong with my setup.