-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-source-drupal): Provide proxyUrl in addition to baseUrl to allow using CDN, API gateway, etc. #36819
Conversation
…ow using CDN, API gateway, etc. gatsbyjs#36811
…ow using CDN, API gateway, etc. gatsbyjs#36811
…ow using CDN, API gateway, etc. gatsbyjs#36811
Co-authored-by: Kyle Mathews <mathews.kyle@gmail.com>
There are 7 failed tests. They seem unrelated to the pull request, am I right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense and looks good — can you add a test or two for this before we merge it?
on the failed tests — yeah we just switched yesterday |
Co-authored-by: Kyle Mathews <mathews.kyle@gmail.com>
@KyleAMathews thanks for the approving words and the READMe suggestions - already committed. I've never written tests for Gatsby, not sure where to begin or end. Will start looking around but any suggestion of a minimal test you would like to see / any pointers how to go about it will be much appreciated! |
The tests are here: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-drupal/src/__tests__/index.js You can run them locally by navigating to the Probably the easiest way to test this is to copy an existing test but with a proxyUrl in the config and then mock the url replacement (you'll need to make it a standalone function to do this I believe) so you can then check that it was called with the variables you expect and returns the right result. Hope that helps! |
@KyleAMathews - thanks for the testing tips. I tried several times from scratch setting up the testing environment according to https://www.gatsbyjs.com/docs/how-to/testing/unit-testing/ but no luck. So did not even get over to writing the tests. I get errors like Perhaps the instructions are outdated, or it has something to do with Gatsby v5 beta, not sure. Can someone help here with writing a test, or can we merge this without more tests for now. If not I am afraid I have to give it up for some period :-( NB I run the modified plugin locally and also in Gatsby Cloud, no issues found, the speedup over direct pull from a powerful Drupal server is 10x, so it's definitely a useful feature. |
Hi again, I need help with the tests / merging this little feature. I am writing a blog article about this performance improvement for Drupal backends and would very much like to mention the version of gatsby-source-drupal where this will have been implemented. |
@KyleAMathews @Vacilando I took a crack at adding a test. lmk if that looks right |
Description
Provide param
proxyUrl
to be used to fetch the Drupal JSON API resources. It can be a CDN or API Gateway URL.In my particular situation - fetch from a Drupal server (32 GB RAM, 8 vCPUs) vs fetch from a CDN (CloudFront) improves the "Fetch all data from Drupal" build phase by a factor of 10. (17s instead of 170s for almost 100k Drupal nodes)
Documentation
Documentation is provided in README in section "CDN".
Related Issues
Fixes / addresses: