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

Working example using BananaCakePop with localhost for Pioneer? #46

Closed
cshadek opened this issue Jun 20, 2022 · 4 comments
Closed

Working example using BananaCakePop with localhost for Pioneer? #46

cshadek opened this issue Jun 20, 2022 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@cshadek
Copy link

cshadek commented Jun 20, 2022

I was trying to get BananaCakePop's desktop Mac application to work with Pioneer as discussed in the docs. I did not change anything with CORS. Is this necessary? I'm not sure what I'm doing wrong. Thanks!

My endpoint info should be correct.
Screen Shot 2022-06-20 at 4 52 01 PM

@cshadek
Copy link
Author

cshadek commented Jun 20, 2022

Every time it tries to fetch the schema it shows this error:

Screen Shot 2022-06-20 at 4 56 42 PM

And the logs show the following:
Screen Shot 2022-06-20 at 4 58 02 PM

@d-exclaimation
Copy link
Owner

d-exclaimation commented Jun 20, 2022

CORS is enforced by the browser when making cross-origin HTTP requests initiated from scripts.

I am pretty sure you don't need to configure CORS for the desktop app of BananaCakePop.

Regardless, BananaCakePop is built with Electron. You should be able to view the DevTools (View / Toogle Developer Tools), check if CORS was applied, and inspect the network request made by the app.

I am not sure why you ran into issues with fetching the schema, I highly recommend checking the network activity and see why the introspection query failed

@d-exclaimation d-exclaimation added the question Further information is requested label Jun 20, 2022
@d-exclaimation
Copy link
Owner

d-exclaimation commented Jun 21, 2022

Looking at the error message, it seemed like Banana Cake Pop did manage to find the Vapor server but it was making a request to an unknown path / route.

You might want to check what path your GraphQL Server is served at. If you call server.applyMiddleware, you are able to set a path like (/api, /graphql) where the server is served at, the default is /graphql if you don't provide anything.

server.applyMiddleware(router, at: "...")

I have tried it on a simple example server and it worked fine.

Screenshot 2022-06-21 at 2 22 33 PM

This example server served GraphQL on http://localhost:8080/graphql.

@d-exclaimation d-exclaimation self-assigned this Jun 21, 2022
@cshadek
Copy link
Author

cshadek commented Jun 21, 2022

So I figured out what I was doing wrong.

I was originally doing this:
server.applyMiddleware(on: app.grouped("main", "v1"))

I switched it to this:
server.applyMiddleware(on: app.grouped("main"), at: "v1")

I didn't realize about the "graphql" default path. So I guess it was hosting it at http://localhost:8080/main/v1/graphql

@cshadek cshadek closed this as completed Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants