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

[Vue warn]: Error in onLoad hook: "TypeError: Cannot read property 'protocol' of undefined" #1089

Open
huster-songtao opened this issue Mar 2, 2022 · 2 comments

Comments

@huster-songtao
Copy link

Versions of relevant software used

  "dependencies": {
    "@improbable-eng/grpc-web": "^0.15.0",
    "@improbable-eng/grpc-web-node-http-transport": "^0.15.0",
    "google-protobuf": "^3.19.4"
  }

What happened
Error in onLoad hook: "TypeError: Cannot read property 'protocol' of undefined"
22:49:28.197 TypeError: Cannot read property 'protocol' of undefined

What you expected to happen
I run the code well in chrome Browser, but not well in app(uniapp)

How to reproduce it (as minimally and precisely as possible):

			grpc.unary(AppGrpcService.GetSettings, {
			  request: new Empty(),
			  host: `https://localhost:7196`,
			  transport: NodeHttpTransport(),
			  metadata: new grpc.Metadata({
				  "UUID": "123456",
				  "Authorization": "Bearer " + accessToken
			  }),
			  onEnd: res => {
				const { status, statusMessage, message } = res // , headers, trailers
				console.log(statusMessage)
				// console.log(message)
				if (status === grpc.Code.OK && message) {
				  // console.log(message)
				  const result = message.toObject()
				  console.log('result', result)
				}
			  }
			})
@huster-songtao
Copy link
Author

			var client = new AppGrpcServiceClient('https://localhost:7196', {
				debug: true,
				transport: NodeHttpTransport()
			});
			
			var request = new ProfileFilterRequest();
			request.setDeviceid('ee4b308b002490ca35eb6dcb79e0391b');
			client.getProfileFilter(request, (error, reply) => {
				console.log(reply)
				if (error) {
					console.error(error);
				}
			});

run the codes above in uniapp,
23:45:29.598 [Vue warn]: Error in onLoad hook: "TypeError: Cannot read property 'protocol' of undefined"
23:45:29.668 TypeError: Cannot read property 'protocol' of undefined

@johanbrandhorst
Copy link
Contributor

I'm not sure how to help you here, there's nothing I can try to run to reproduce this, and there's no backtrace to tell us where the error is coming from. You can look at our tests for examples of how to use the packages.

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

2 participants