Hi team , facing issue with nextjs integration
# general
k
Hi team , facing issue with nextjs integration
p
hey @Krishan Kant welcome to SigNoz community do share more details on what you have tried and what issue you are facing
k
Getting some GRPC ERROR while running the app
@Pranay
p
@Ashu do you have ideas on this
a
@Krishan Kant can you share your
tracing.js
code?
k
'use strict' const opentelemetry = require('@opentelemetry/sdk-node'); const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node'); const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc'); const {trace} = require("@opentelemetry/api"); const { Resource } = require('@opentelemetry/resources'); const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions'); // custom nextjs server const { startServer } = require('./server'); // configure the SDK to export telemetry data to the console // enable all auto-instrumentations from the meta package const exporterOptions = { url: 'http://localhost:4317', } const traceExporter = new OTLPTraceExporter(exporterOptions); const sdk = new opentelemetry.NodeSDK({ resource: new Resource({ [SemanticResourceAttributes.SERVICE_NAME]: 'Test-nach' }), traceExporter, instrumentations: [getNodeAutoInstrumentations()] }); const tracer = trace.getTracer( 'my-service-tracer' ); // initialize the SDK and register with the OpenTelemetry API // this enables the API to record telemetry sdk.start() .then(() => console.log('Tracing initialized')) .then(() => startServer()) .catch((error) => console.log('Error initializing tracing', error)); // gracefully shut down the SDK on process exit process.on('SIGTERM', () => { sdk.shutdown() .then(() => console.log('Tracing terminated')) .catch((error) => console.log('Error terminating tracing', error)) .finally(() => process.exit(0)); }); module.exports = {sdk,tracer}
@Ashu
a
Can you update your
exporterOptions
to include the following and let me know: const exporterOptions = { url: 'http://localhost:4317', credentials: grpc.credentials.createInsecure(), } @Krishan Kant
k
same issue @Ashu
a
Okay. Tagging @Vishal Sharma to help you out. Give us sometime to get back.
k
sure
v
@Krishan Kant Which doc/tutorial did you follow? Please follow this: https://signoz.io/blog/opentelemetry-nextjs/
k
followed the same @Vishal Sharma