0

Magento 2 PWA

When we run the command "yarn run watch" then getting this error on the console -

FetchError: invalid json response body at https://xxx/graphql reason: Unexpected token c in JSON at position 0

Following that link - https://developer.adobe.com/commerce/pwa-studio/tutorials/setup-storefront/

Even on .env file URL is properly set -

MAGENTO_BACKEND_URL=https://xxx

Anyone knows how to resolve this ?

1 Answer 1

0

I am fetching this error when I apply commands yarn run watch commands. but I have a solution below step.

Step 1: First I will change my PHP version php8.1 to php 8.2

=> sudo a2dismod php8.1

=> sudo a2enmod php8.2

=> sudo update-alternatives --set php /usr/bin/php8.2

=> sudo service apache2 restart

After i go to magento 2 root directory and app/etc/env.php

change

 'session' => [
    'save' => 'file'
],

to

  'session' => [
    'save' => 'db'
],

after applying the below commands

sudo php bin/magento s:up && sudo php bin/magento setup:di:compile && php bin/magento s:static-content:de -f && php bin/magento c:f && chmod -R 777 var/ pub/ generated/ app/etc

I hope to help with this solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.