Effect CommunityEC
Effect Community2mo ago
4 replies
Maks

Error When Using `Effect.runPromise` Inside an Effect

Hey Mattia,

Quick question:

Why am I getting this error

Using Effect.runPromise inside an Effect is not recommended. The same runtime should generally be used instead to run child effects.
Consider extracting the Runtime by using for example Effect.runtime and then use Runtime.run* with the extracted runtime instead.    effect(runEffectInsideEffect) (effect 32)


If I'm using Effect.runPromise(myEffect); inside a regular async function?

sendEmail: async ({ email}) => {
              const result = someEffect({
                emailTo: [email],
              });
              Effect.runPromise(result);
            },


Note the lib I'm using, expects a promise. I also wrap that lib into Effect.Service. Shouldn't it recognize that i use Effect.runPromise inside an async func?
Was this page helpful?