Installed Drupal8 on localhost
Installed JSON api module and gave anonymous users permission
Installed gatsby drupal module
Entered baseurl and apibase correctly
my http://localhost/jsonapi is returning valid json and I can curl it perfectly
Should run without errors
Throws 405 error:
error Plugin gatsby-source-drupal returned an error
Error: Request failed with status code 405
System:
OS: macOS High Sierra 10.13.3
CPU: x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.9.4 - /usr/local/bin/node
npm: 6.3.0 - /usr/local/bin/npm
Browsers:
Chrome: 68.0.3440.84
Safari: 11.0.3
npmPackages:
gatsby: ^1.9.277 => 1.9.277
gatsby-link: ^1.6.46 => 1.6.46
gatsby-plugin-react-helmet: ^2.0.11 => 2.0.11
gatsby-source-drupal: ^2.0.41 => 2.0.41
npmGlobalPackages:
gatsby-cli: 1.1.58
gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A
@belgianwolfie can you update your packages to the latest version?
@Chuloo getting identical errors. Gatsby and drupal site were both created in the last hour. Can also confirm my test site is available: http://nicklewisatx8jeduqqrqmb.devcloud.acquia-sites.com/jsonapi
My gatsby-config.js is as bare bones as it gets.
module.exports = {
siteMetadata: {
title: 'Gatsby Default Starter',
},
plugins: [
'gatsby-plugin-react-helmet',
{
resolve: gatsby-source-drupal,
options: {
baseUrl: http://nicklewisatx8jeduqqrqmb.devcloud.acquia-sites.com/,
apiBase: jsonapi, // optional, defaults to jsonapi
},
}
],
}
@Chuloo @belgianwolfie this is a problem with the jsonapi module.
The following uri is what returns 405 breaking the whole thing:
/jsonapi/contact_message/personal
You can work around it by uninstalling the contact form.
Linking jsonapi issue for reference: https://www.drupal.org/project/jsonapi/issues/2991231
Provided explanation at https://www.drupal.org/project/jsonapi/issues/2991231#comment-12721346 :)
馃憤 sounds like we should just ignore 405 errors then. Anyone interested in working on a PR?
uninstalling the contact module did the trick for me. Thanks so much all that contributed.
@KyleAMathews Took a crack at a PR but being relatively new to gatsby and node, I think it may be over my head. Here's what I learned.
@wimleers not to be argumentative, but why include the contact message endpoint at /jsonapi at all if it's assumed to be broken without contact_storage module enabled? Also briefly looked into a pr for that, but haven't had time yet to figure out how those links get added to the endpoint root. (a simple module enable check seems reasonable, no?)
@nicklewisatx my guess is that that endpoint allows access with method types other than GET.
@nicklewisatx
@wimleers not to be argumentative, but why include the contact message endpoint at /jsonapi at all if it's assumed to be broken without contact_storage module enabled?
@tmccombs's guess is correct:
@nicklewisatx my guess is that that endpoint allows access with method types other than GET.
This was simply a wrong assumption in this API client; the #7318 PR fixed it! 馃帀
Most helpful comment
@nicklewisatx my guess is that that endpoint allows access with method types other than GET.