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

Blueprint/Entry/CP Bugs #10598

Closed
Victor-Miguel1405 opened this issue Aug 8, 2024 · 7 comments
Closed

Blueprint/Entry/CP Bugs #10598

Victor-Miguel1405 opened this issue Aug 8, 2024 · 7 comments

Comments

@Victor-Miguel1405
Copy link

Bug description

Hi guys! I'm having some issues with the CP can someone help me?
First error is happening on the blueprints. When I try to create new fields and edit the blueprint, i get some errors:

  1. Infinite loading when adding or editing a field.
  2. Error when tryng to save created or edited field;
    3 Created fields just not appear.
    Infinite loading:
    image_error
    Error in the console:
    image_error2

So I just close and open again multiple times, and click to save multiple times until it finally works.

Also I'm getting a lot of errors related to saving the field. When creating an Entry for example, I get the error "Couldn't save entry", but it ends up saving it, and when I try to save it again it says that it already exists.

image_error3

Then, I decided to take a peak in the console and this was the JSON being sent in the request:

image_error4

Is this JSON correct? It looks weird.

Some more console errors:

image

Tried to delete and got this:

image

Tried again:

image

It was deleted on the first try, althought presented error.

Also having a little bug when selecting entries to delete. The bar with options just looks like this:

image_error5

Just some extra details:

-It's happening in more than one browser. Tested it on Edge and Chrome.

  • I'm currently using the newest version of Statamic and plugins;

How to reproduce

I don't know if everyone is getting these errors, but to reproduce it just act normally, create blueprints, entrys, taxonomies, edit fields in blueprints, try to save entries and blueprints.

Logs

Magically, there's nothing in laravel logs. I caught some errors on the console of DevTools related to JS properties as you can see in the description. Reproduced all error with the laravel logs opened and nothing.

Environment

Environment
Application Name: houseTI
Laravel Version: 11.17.0
PHP Version: 8.3.9
Composer Version: 2.7.7
Environment: production
Debug Mode: ENABLED
URL: www.houseti.com.br
Maintenance Mode: OFF
Timezone: America/Sao_Paulo
Locale: pt_BR

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: database
Session: database

Statamic
Addons: 10
Sites: 1
Stache Watcher: Enabled
Static Caching: half
Version: 5.19.0 Solo

Statamic Addons
aerni/font-awesome: 3.0.1
aryehraber/statamic-captcha: 1.12.1
dryven/faviconator: 1.3.1
eminos/statamic-iconify: 1.3.0
eminos/statamic-tabs: 1.2.0
ndx/statamic-bard-color-picker: 2.0.0
o1y/statamic-flexible-width: 1.0.1
studio1902/statamic-peak-browser-appearance: 3.5.0
studio1902/statamic-peak-seo: 8.15.3
studio1902/statamic-peak-tools: 3.4.3

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@duncanmcclean
Copy link
Member

duncanmcclean commented Aug 8, 2024

Hmm, I'm not sure what's happening. No one else has reported these issues before 🤔

What does your app/Providers/AppServiceProvider.php file look like? Are you calling Json::withoutWrapping() anywhere?

@Victor-Miguel1405
Copy link
Author

Victor-Miguel1405 commented Aug 8, 2024

My AppServiceProvider.php :::

<?php

namespace App\Providers;

use App\Markdown\SpanExtension;
use App\Rules\Fqdn;
use DeviceDetector\DeviceDetector;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\ServiceProvider;
use Request;
use Statamic\Facades\Markdown;
use Statamic\Statamic;
use Studio1902\PeakSeo\Handlers\ErrorPage;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Statamic::vite('app', [
            'resources/css/cp.css',

        ]);

        ErrorPage::handle404AsEntry();

        Markdown::addExtension(fn () => new SpanExtension('|'));

        $this->bootValidator();

        $this->bootMacros();
    }

    public function bootValidator()
    {
        $rules = [
            'fqdn' => Fqdn::class,
        ];

        foreach ($rules as $name => $class) {

            $rule = new $class;

            $extension = static function ($attribute, $value) use ($rule) {

                return $rule->passes($attribute, $value);
            };

            $this->app['validator']->extend($name, $extension, $rule->message());

        }

    }

    public function bootMacros()
    {
        Request::macro('device', function (): ?DeviceDetector {
            /** @var Request $self */
            $self = $this;
            $cache = cache()->driver('array');

            return $cache->rememberForever('request-device-'.spl_object_id($self), function (): DeviceDetector {
                $device = new DeviceDetector(request()->userAgent());
                $device->parse();

                return $device;
            });

        });

        Http::macro('whatsapp', function (): PendingRequest {
            return Http::withToken(Config::get('whatsapp.authToken'))
                ->throw()
                ->baseUrl('https://graph.facebook.com/v20.0/')
                ->withOptions(['phoneId' => Config::get('whatsapp.phoneId')]);
        });
    }
}

No, not calling Json::withoutWrapping() anywhere
image

@duncanmcclean
Copy link
Member

Okay, that all looks fine. 🤔

Are you able to give us access to the repository so we can take a look? Are you able to replicate the issue on a fresh Statamic install?

@Victor-Miguel1405
Copy link
Author

Could I send you my repository in private in .zip ? My project is not here in github, it's in my company private repository.
I'll try to replicate it on a fresh install as soon as I can. Probably I'll not be able to replicate it. Didn't see anybody with the same issue . Just some extra information, I was doing the project on Statamic 4 and laravel 10. I updated everything mid project.

@duncanmcclean
Copy link
Member

Sure. You can send it to [email protected].

@duncanmcclean
Copy link
Member

Hmm, strangly enough, even using the site you sent over, I'm not seeing any of the issues you pointed out.

Adding/editing fields in blueprints and fieldsets work as expected. Saving entries works as expected (the payload is valid JSON, unlike the screenshot you provided). The actions on the listing table are showing correctly.

I'm also not seeing any errors in my browser console or in the Laravel log file.

Do these issues happen locally for you, or only on production?

@duncanmcclean
Copy link
Member

Since we're not able to reproduce the issue on the repository you sent over, it probably means it's something to do with your local/server setup, rather than Statamic.

As I haven't heard back in over a month, I'm going to close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants