tanner.svg → created an issue.
@mukeysh I do not use ddev personally so I can not confirm that this is a working solution, but based on my learnings about this issue and that the key to resolving it for myself was setting the DRUSH_OPTIONS_URI
environment variables, I would suggest the following:
Add the following to your project's .ddev/config.yaml
:
web_environment:
- DRUSH_OPTIONS_URI=$DDEV_PRIMARY_URL
Looks like you can also use the CLI if you wanted. Reference to ddev docs here --> https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#environment-variables-for-containers-and-services
To check if it worked, go to your .stories.json
file for one of your stories after generating stories with the drush command. You want it to be using your sites URI in the server URL. For example:
"parameters": {
"server": {
"url": "http://my-site-url.ddev/storybook/stories/render"
}
},
If the value is "http://default/storybook/stories/render"
then it's not working.
tanner.svg → created an issue.
I was running in the same issue where after following the "Drupal & Storybook in 5 Minutes" video and generating the .stories.json
files using drush storybook:generate-stories
.
I was met with the following error:
Upon reviewing my button.stories.json file I observed the same server URL as shown in this issue's screenshot.
"parameters": {
"server": {
"url": "http://default/storybook/stories/render"
}
},
Note: I am NOT using a container (docker, ddev, lando) for my local environment (my development environment is running directly on my local machine).
----
In my case the solution was to add:
export DRUSH_OPTIONS_URI="http://my-local-site-url.localhost"
to my ~/.bash-profile, delete the already generated .stories.json files, then re-run drush storybook:generate-stories
. After that the generated JSON was corrected to:
"parameters": {
"server": {
"url": "http://my-local-site-url.localhost/storybook/stories/render"
}
},
and my stories began working as expected.
----
Additional note: I did reference a .lando.yml file to come to the conclusion as to what I needed. I've never needed this environment variable set to work on a Drupal site prior to using this module so maybe something could be added to this module to account for that? Or perhaps document how to work around this scenario if not using a container. Here's the lando config i referenced where this environment variable is set.
tooling:
drush:
service: appserver
env:
DRUSH_OPTIONS_URI: "https://my-local-site-url.lndo.site/"