Skip to content
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

next-drupal-basic-starter get 400 bad request #161

Closed
parkerCYH opened this issue Apr 18, 2022 · 7 comments
Closed

next-drupal-basic-starter get 400 bad request #161

parkerCYH opened this issue Apr 18, 2022 · 7 comments

Comments

@parkerCYH
Copy link

According quick start, I was working decouple Drupal with Nextjs and JSONAPI, and stuck.

pages/index.tsx (43:16) @ async getStaticProps

41 |   context
42 | ): Promise<GetStaticPropsResult<IndexPageProps>> {
> 43 |   const nodes = await getResourceCollectionFromContext<DrupalNode[]>(
   |                ^
44 |     'node--article',
45 |     context,
46 |     {

And I try to find error on next-drupal, I found that 'src/utils.ts::getJsonApiIndex' will check the response of http://example.com/jsonapi and it prints 400 bad request. Detail is "The following query parameters violate the JSON:API spec: 'q'."
I also checked http://example.com/jsonapi/node/article and http://example.com/jsonapi/node/article/{id} looks good.
I have no idea how to fix it, need help please.

@shadcn
Copy link
Collaborator

shadcn commented Apr 18, 2022

Hmm what are you running your Drupal site on? Valet? ddev?

@parkerCYH
Copy link
Author

Laravel Valet 2.18.4

@shadcn
Copy link
Collaborator

shadcn commented Apr 18, 2022

Yeah I'm on Laravel Valet and I've definitely seen this. Can you try updating Valet and check? It looks like there was a fix committed recenlty: laravel/valet#1218

@parkerCYH
Copy link
Author

parkerCYH commented Apr 18, 2022

I upgrade valet to 3.1.3, and rebuild drupal, it works. thanks!
Could I preview the content in Next style before submit form?

@shadcn
Copy link
Collaborator

shadcn commented Apr 18, 2022

@EustaceCheng You mean when editing content? Right now you can save and preview draft. The native Drupal preview is not supported yet but we are looking into it here #132

@parkerCYH
Copy link
Author

Thanks for your reply.

@aprice42
Copy link

@shadcn I also ran into this issue and updating laravel to 3.1.3 fixed it for me too.

As I was experiencing this error I was wishing for a common "gotchas" section in the tutorial. And IMO this issue would be a nice addition (or maybe there are not so many valet users out there?). In any case, it would have saved me a few hours of digging around. 😉

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

No branches or pull requests

3 participants