Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to connect a docker-run Go gRPC server to a React app? #1425

Closed
altjimmy opened this issue May 19, 2024 · 0 comments
Closed

How to connect a docker-run Go gRPC server to a React app? #1425

altjimmy opened this issue May 19, 2024 · 0 comments

Comments

@altjimmy
Copy link

My first time here, doing a college project, have almost 0 experience with gRPC and web dev in general, so any advice is very much appreciated and please be patient with me.

The situation is: me and my classmate are building a web-module for loyalty service, i am making a client side, and he's working on server with Go and gRPC. I am using React and JS.

My classmate sent me a folder with all the files for the server, i did the docker-compose up, and it is running on my 44044 port.
In my react app i generated two .js files from .proto file, ServiceLoyalty_pb.js and ServiceLoyalty_grpc_web_pb.js, they're stored in my src/generated folder.

But when i try to import it in my Page.jsx file (import { LoyaltyServiceClient } from '../../generated/ServiceLoyalty_grpc_web_pb';), the browser returns this:
Uncaught SyntaxError: The requested module http://localhost:5173/src/generated/ServiceLoyalty_grpc_web_pb.js doesn't provide an export named: 'LoyaltyServiceClient' Operations.jsx:20:10

I checked the ServiceLoyaltyServiceLoyalty_grpc_web_pb,js file, it seems to be ok, but still my .jsx page refuses to see it and import it.
Still, when hovering over the import, it seems to recognize it correctly image

What am i missing? Thank you in advance.

@grpc grpc locked and limited conversation to collaborators May 20, 2024
@sampajano sampajano converted this issue into discussion #1426 May 20, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant