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

k6 grpc Examples inport error #3571

Closed
owanio1992 opened this issue Jan 27, 2024 · 2 comments
Closed

k6 grpc Examples inport error #3571

owanio1992 opened this issue Jan 27, 2024 · 2 comments
Assignees

Comments

@owanio1992
Copy link

Brief summary

in this doc
https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/grpc/stream/
import { Client, Stream } from 'k6/experimental/grpc';

but in git
https://github.com/grafana/k6/blob/master/examples/grpc_client_streaming.js
https://github.com/grafana/k6/blob/master/examples/grpc_server_streaming.js
it's

import { Client, Stream } from 'k6/net/grpc';

and use git script (both grpc_client_streaming.js, grpc_server_streaming.js )
it's will get error

ERRO[0000] TypeError: Cannot read property 'name' of undefined
        at pointSender (file:///k6-master/examples/grpc_client_streaming.js:112:12(5))
        at file:///k6-master/examples/grpc_client_streaming.js:102:16(60)  executor=per-vu-iterations scenario=default source=stacktrace

k6 version

v0.48.0

OS

linux ubuntu 22

Docker version and image (if applicable)

latst Digest: sha256:4f9845e7f2efc9abdc3aba5d49e96fd6020ea167a722e0014e848409cc9cd4f5

Steps to reproduce the problem

# start server
git clone [email protected]:grafana/k6.git
go run -mod=mod examples/grpc_server/*.go

# test
k6 run examples/grpc_client_streaming.js

Expected behaviour

no error

Actual behaviour

get error

ERRO[0000] TypeError: Cannot read property 'name' of undefined
        at pointSender (file:///k6-master/examples/grpc_client_streaming.js:112:12(5))
        at file:///k6-master/examples/grpc_client_streaming.js:102:16(60)  executor=per-vu-iterations scenario=default 
@olegbespalov
Copy link
Contributor

olegbespalov commented Jan 29, 2024

Hi @owanio1992

In the k6 v0.49, which just happened, the gRPC experimental module was graduated, and streams became part of the core.

The examples in git were updated since the change was merged. So if you update to the v0.49 you could import as:

import { Client, Stream } from 'k6/net/grpc';

However, the error doesn't seem related to imports 🤔

ERRO[0000] TypeError: Cannot read property 'name' of undefined
        at pointSender (file:///k6-master/examples/grpc_client_streaming.js:112:12(5))
        at file:///k6-master/examples/grpc_client_streaming.js:102:16(60)  executor=per-vu-iterations scenario=default source=stacktrace

seems like the pointSender picked the point from sample DB without the name property defined, which is weird.

Are you trying to run an unmodified version of the example?

@olegbespalov olegbespalov added the awaiting user waiting for user to respond label Jan 29, 2024
@owanio1992
Copy link
Author

owanio1992 commented Feb 12, 2024

I tried use v0.49.0
it's can work with

import { Client, Stream } from 'k6/net/grpc';

thank very much

@olegbespalov olegbespalov removed awaiting user waiting for user to respond bug triage labels Feb 12, 2024
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