Coder Social home page Coder Social logo

Comments (12)

Tregonia avatar Tregonia commented on June 2, 2024 3

Wanted to leave this here for anyone that may come to this error.

This error is thrown when the data being passed through embeds and twig structure, is being broken, and a template is receiving null.

The best solution is to check what variables are present in each template as you go down the line. If there are multiple errors like this in the stack, this will output multiple errors.

Example #1
Example #1 is the difference between these two examples. When the variable is null, or does not exist due to typo or misalignment of data, this error will be thrown.

{% include  '@themetheme/menu/menu.twig' with menu only %}

and

{% include  '@themetheme/menu/menu.twig' with main_menu only %}

Example #2
The second example is the difference between these examples. Because of the use of the only keyword, the site_footer variable was not passed, and is null is presented to the component. When the Twig include is executed as part of the layout.twig template, the data is not available.

{% embed '@theme/layout/layout.twig' with {
  "modifier": "footer",
  "site_footer": site_footer
} only %}
  {% block page_footer %}
   {% include '@theme/site-footer/site-footer.twig' with site_footer only %}
  {% endblock page_footer %}
{% endembed %}

and

{% embed '@theme/layout/layout.twig' with {
  "modifier": "footer",
} only %}
  {% block page_footer %}
   {% include '@theme/site-footer/site-footer.twig' with site_footer only %}
  {% endblock page_footer %}
{% endembed %}

from bolt.

margoromo avatar margoromo commented on June 2, 2024

Hello!

We received your note - I will have someone respond shortly. Thank you for notifying us.

-Margo Romanowski
Bolt Design System Product Owner

from bolt.

sghoweri avatar sghoweri commented on June 2, 2024

@kemiga we ran into the same issue recently (might be an upstream dependency problem) and ended up needing to lock down the version of the @bolt/twig-renderer composer.json file (in the packages/twig-renderer folder) to be 1.36.0 + re-run composer update.

At the moment our Travis CI builds seem to be checking out ok but this is still high on our radar to look further into + make sure everything is working as expected!

Out of curiosity, are you running the latest code that's up on master? Also, just wanted to double check: are you seeing this particular error message after (roughly) following the Developer Getting Started guide?

https://boltdesignsystem.com/docs/development/local-dev-environment-setup.html

from bolt.

kemiga avatar kemiga commented on June 2, 2024

@sghoweri yes cloned from master and have pulled the latest changes.

And yes I was following the getting started guide. npm run setup runs without issues and on running npm start everything builds/compiles fine until it starts compiling the static site.

The twig/twig version is set to 1.36.0 in the code I have checked out. I've tried re-running composer update in packages/twig-renderer but am still getting a 'PHP TwigRenderer Error'.

from bolt.

AnthonySGeorge avatar AnthonySGeorge commented on June 2, 2024

Hi, I've just done a fresh install and am having the same issue at the same point as kemiga.

from bolt.

AnthonySGeorge avatar AnthonySGeorge commented on June 2, 2024

Hi, this is still an issue for me in both the master and the 2.x branches

from bolt.

adamszalapski avatar adamszalapski commented on June 2, 2024

@AnthonySGeorge you can try npm run clean and then composer clearcache make sure that all 'vendor' and 'node_modules' folders. After this try to run npm run setup and then npm start.

from bolt.

Hubbz avatar Hubbz commented on June 2, 2024

@AnthonySGeorge I was having this issue too and just updating npm to the latest version worked for me.

from bolt.

glassdimly avatar glassdimly commented on June 2, 2024

I'm getting this issue as well, here's a link to my composer.lock. I'm on master. https://github.com/boltdesignsystem/bolt/blob/master/docs-site/composer.lock#L283

Steps taken:

  • rm -rf docs-site/vendor && composer install
  • rm -rf node_modules && yarn install && yarn start

from bolt.

glassdimly avatar glassdimly commented on June 2, 2024

Turned out this was because I was using node v12.13.0. Node v12.10.0 works fine.

from bolt.

mariohernandez avatar mariohernandez commented on June 2, 2024

Are there any updates on this issue? I am experiencing the same error message when running npm run build or npm run watch (both gulp tasks). I have removed the node_modules folder and also package-lock.json but no luck. I even downgraded the node version to 12.10.0 as @glassdimly suggested. Here's my errors:
PHP TwigRenderer Error: The response callback is expected to resolve with an object implementing Psr\Http\Message\ResponseInterface, but rejected with "Error" instead.. I'd appreciate any tips or feedback to solve this issue.

from bolt.

thamas avatar thamas commented on June 2, 2024

Thanks @Tregonia for the detailed info! ^^

from bolt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.