Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is Pattern twig-php is broken and doesn't render any patterns? #1505

Closed
sridhar614 opened this issue May 5, 2024 · 2 comments
Closed

Is Pattern twig-php is broken and doesn't render any patterns? #1505

sridhar614 opened this issue May 5, 2024 · 2 comments

Comments

@sridhar614
Copy link

Hi I am running pattern lab node with version 18, with twig php support on Drupal 10 project, I don't see .html files are creating under public directory and seeing below errors

Warning: Undefined array key "data" in /Users/sridhar/pattern_twig/node_modules/@basalt/twig-renderer/dist/server--async.php on line 115
PHP TwigRenderer Error: The response callback is expected to resolve with an object implementing Psr\Http\Message\ResponseInterface, but rejected with "TypeError" instead.

I am using Pattern Lab Node v6.1 on Mac, with Node v18, using a Gulp | Grunt | Vanilla | Custom Edition.

Expected Behavior

Pattern lab should render the patterns with twig php engine

Actual Behavior

Patterns doesn't render and throws below error

Warning: Undefined array key "data" in /Users/sridhar/pattern_twig/node_modules/@basalt/twig-renderer/dist/server--async.php on line 115
PHP TwigRenderer Error: The response callback is expected to resolve with an object implementing Psr\Http\Message\ResponseInterface, but rejected with "TypeError" instead.
Steps to Reproduce

npm create pattern-lab
select twig-php with demo patterns
npm run start

@heshanlk
Copy link

The problem starts from one of the dependency libraries @basalt/twig-renderer. Upgrading to version 3.0 of this library is causing issues with version 6.1.0 of Pattern Lab. As a temporary solution, I can suggest reverting to an older version of @basalt/twig-renderer.

Follow the steps below to implement this workaround.

Run

npm i @pattern-lab/engine-twig-php@6.0.1
This will downgrade the @pattern-lab/engine-twig-php as well as use the 2.x version of the @basalt/twig-renderer package.

npm start

@sridhar614
Copy link
Author

Thanks @heshanlk that helped to resolve the issue

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants