Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Trying to use sqlx database pool inside a juniper GraphQL subscription resolver

Notifications You must be signed in to change notification settings

mathroc/juniper-sqlx-subscriptions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trying to use a sqlx database pool inside a juniper GraphQL subscription resolver


Note: the solution has been found : #2


The issue:

$ cargo run
   Compiling juniper-sqlx-subscriptions v0.1.0 (/home/mathieu/Projects/repro/juniper-sqlx-subscriptions)
error[E0759]: `executor` has lifetime `'ref_e` but it needs to satisfy a `'static` lifetime requirement
  --> src/main.rs:47:19
   |
40 |   #[graphql_subscription(context = Context)]
   |   ------------------------------------------ this data with lifetime `'ref_e`...
...
47 |           let stream = async_stream::stream! {
   |  ______________________^
48 | |             loop {
49 | |                 interval.tick().await;
50 | |
...  |
56 | |             }
57 | |         };
   | |_________^ ...is captured here...
   |
note: ...and is required to live as long as `'static` here
  --> src/main.rs:40:1
   |
40 | #[graphql_subscription(context = Context)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the macro `$crate::async_stream_impl::stream_inner` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0759`.
error: could not compile `juniper-sqlx-subscriptions` due to previous error

some context:

If someone has a solution, feel free to open a Pull Request ! 🙏

About

Trying to use sqlx database pool inside a juniper GraphQL subscription resolver

Topics

Resources

Stars

Watchers

Forks

Languages