artisan-cloudflare icon indicating copy to clipboard operation
artisan-cloudflare copied to clipboard

Unable to set static zone in cloudflare.php

Open bertalanimre opened this issue 5 years ago • 5 comments

Hey Seb!

Thanks for your work, it works like a charm if it comes to adding the zone in the terminal after the command. However I'm trying to add a permanent zone to the config file but I keep getting the same error message: Please supply a valid zone identifier in the input argument or the cloudflare config.

Your example isn't working either from the file. It doesn't give any syntax error just the above. I have tried like:

'zones' => 'asd123asd123asd123asd123asd';
'zones' => [
        'asd123asd123asd123asd123asd'
    ],
'zones' => [
        'asd123asd123asd123asd123asd' => []
    ],

And also your example. Please help me (us) out a bit.

bertalanimre avatar Jun 04 '19 11:06 bertalanimre

I will check this today. Thanks for letting me know!

sebdesign avatar Jun 04 '19 16:06 sebdesign

I don't see anything suspicious on my side. Can you check that your configuration is not cached? Please run php artisan config:clear and try again.

By the way, this is the correct structure for the configuration:

'zones' => [
    'asd123asd123asd123asd123asd' => [],
],

sebdesign avatar Jun 05 '19 23:06 sebdesign

The config:clear command was already used a number of times. It did not help to solve the issue. However the comma at the end of the square brackets after the zone ID did help! lol me... Thanks for clarifying the example for me.

Alto I prefer to use it this way:

'zones' => [
    env('CLOUDFLARE_ZONEID') => [],
],

But clearly this doesn't work. Am I using a wrong syntax here or what? I would prefer this method because then the package could be used slightly more easy and convenient. I recommend implementing it in the code.

bertalanimre avatar Jun 06 '19 08:06 bertalanimre

The CLOUDFLARE_ZONEID environment variable is a nice idea! I will add it to the configuration in the next release.

There's nothing wrong with your setup, but I'm not sure how to solve this issue. Can you dd($zones) in the constructor of the purge command in your vendor? https://github.com/sebdesign/artisan-cloudflare/blob/master/src/Commands/Cache/Purge.php#L58

The $zones should be exactly the same as your configuration.

Then you should try to dd() the various statements in the getZones() method:

https://github.com/sebdesign/artisan-cloudflare/blob/master/src/Commands/Cache/Purge.php#L234

This method is called just before the Please supply a valid zone identifier in the input argument or the cloudflare config. is raised. So it could help us debug this.

Let me know about your findings, thanks!

sebdesign avatar Jun 06 '19 10:06 sebdesign

Unfortunately I just left for vacation and my projects are unreachable (thank god) so I'll be free of duty for a few days. :) I'm glad I've gave you an idea. If this issue won't be closed and I'll be back, I'm gonna test what you are asking Mate !

bertalanimre avatar Jun 06 '19 11:06 bertalanimre