-
Notifications
You must be signed in to change notification settings - Fork 88
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
ReferenceError: self is not defined #579
Comments
Hello @majian159, is this a front-end application with Next.js? You can see if it's similar #566 |
No, I solved this problem by configuring // next.config.mjs
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverComponentsExternalPackages: ["@dapr/dapr"],
},
};
export default nextConfig; which allowed me to use DaprHttpClient in my nextjs application, but the GRPCClient still indicates it cannot connect: == APP == ⨯ Error: DAPR_SIDECAR_COULD_NOT_BE_STARTED
== APP == at DaprClient.awaitSidecarStarted (/Users/majian/Source/jkzl/tutu-langchain/node_modules/.pnpm/@[email protected]/node_modules/@dapr/dapr/implementation/Client/DaprClient.js:164:23)
== APP == at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
== APP == at async GRPCClient._startAwaitSidecarStarted (/Users/majian/Source/jkzl/tutu-langchain/node_modules/.pnpm/@[email protected]/node_modules/@dapr/dapr/implementation/Client/GRPCClient/GRPCClient.js:157:9)
== APP == at async GRPCClient.start (/Users/majian/Source/jkzl/tutu-langchain/node_modules/.pnpm/@[email protected]/node_modules/@dapr/dapr/implementation/Client/GRPCClient/GRPCClient.js:166:9)
== APP == at async GRPCClient.getClient (/Users/majian/Source/jkzl/tutu-langchain/node_modules/.pnpm/@[email protected]/node_modules/@dapr/dapr/implementation/Client/GRPCClient/GRPCClient.js:73:13)
== APP == at async GRPCClientState.save (/Users/majian/Source/jkzl/tutu-langchain/node_modules/.pnpm/@[email protected]/node_modules/@dapr/dapr/implementation/Client/GRPCClient/state.js:47:24) It appears to be a compatibility issue of grpc within the nextjs framework. I hope the dapr js sdk can be made compatible with nextjs. |
That is great to know. I think the SDK's next.js users are increasing, it might be worth having a FAQ section or documentation on how to use Dapr with Next.js.
This error suspiciously looks similar to the issue I mentioned. The problem there was that next JS was running a piece of code when the Dapr sidecar was not available. You could try to run a sidecar in parallel to confirm the hypothesis. The OP of the other issue managed to make it work by putting their code under |
Hi, we figured out the reason for the gRPC issue, it was a regression. Please see #580 |
Thank you very much, after updating to @dapr/dapr 3.3.1 this issue has disappeared. |
Expected Behavior
Actual Behavior
I encountered the following error while using the Dapr JS SDK in Next.js:
code:
Steps to Reproduce the Problem
The text was updated successfully, but these errors were encountered: