rivet
rivet copied to clipboard
[Feature]: Documentation should show how to import rivet-core/rivet-node into your project
Feature Request
Documentation site should include a guide or pointers on what node packages to import and how to get started with using Rivet embedded into your application.
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Anything missing here? https://rivet.ironcladapp.com/api-reference/getting-started-integration
@gogwilt just checking if there's anything the docs are missing, otherwise we can probably close
I'm not able to get the example working in the docs out of the box.
https://rivet.ironcladapp.com/docs/api-reference/getting-started-integration
Specifically this line results in an error
myEvent: (data: DataValue): Promise<void> => {
The error is:
A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
The doc also has references/assumptions that aren't quite clear to the user if this is the first spot that they come to.
- References .rivet as project file, but app saves as .rivet-project
- The Graph name implies using the name directly, but I could only get it working with a path "project/graph" (note i can't get output since the event
- Void doesn't work as described above
- Doc assumes understanding that you need to run this as Typescript (.js and .tsx result in an error due to the import. It is mentioned in other areas of the doc, but this example stand alone)
- The example here isn't represented in the example repo, making it difficult to jump from this to the full app example in Git
I'll fully admit I'm jumping back in Node for the first time in years, and never used it with TS. So the void
error may not give others issues, but I've been unable to get the function running after providing a return or replacing void with a type while trying to configure a return value it appears to require.
Would appreciate any assistance getting this running. I can strip the code to print to console to run my graph, but that doesn't allow me to see the results. Anything I've done to apply a type and a return results in further errors.
Anything on this? I'm also unable to get this project to integrate with next.js and am trying to pull pieces from the docs but not working.
@kojikeneda I'll need more information about what's going wrong in order to help you. The docs page linked should have the instructions necessary to import rivet-node
, and I've confirmed that it works in next.js. I welcome any PRs to add any next.js-specific integration docs!
A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value.
This is a TypeScript compilation error, and indicates you're not returning a Promise from the function. The easiest way to return a promise is to mark the function as async
.
* References .rivet as project file, but app saves as .rivet-project
That sounds like a mistake in the docs yeah!
* The Graph name implies using the name directly, but I could only get it working with a path "project/graph" (note i can't get output since the event
For the graph
parameter, you have to pass in either the ID of the graph or the name of the graph. project/graph
should never work (unless you mean you're using folders)
* Doc assumes understanding that you need to run this as Typescript (.js and .tsx result in an error due to the import. It is mentioned in other areas of the doc, but this example stand alone)
Importing in JS should work fine, what error are you getting?
* The example here isn't represented in the example repo, making it difficult to jump from this to the full app example in Git
More example projects is definitely something we could work on
As far as the errors importing into JS I'm referring to your getting started integration. That gave a couple of errors I no longer have, but once I moved to running it as typescript it ran without errors. That's where I believe clarity could be added. I've linked the doc I'm referring to at the end of this comment.
You pointed to "the docs page linked" to Kojikeneda, but the only doc you have linked is a 404 error. Is there a different doc from the one that I posted I should be following?
As far as not returning a promise I'm using the doc I link below. I'm not doing anything but running the code in the basic example. If that is not intended to work independently it should be rewritten as "getting started" implies you will have something fully functional, if not incredibly basic, by the end of the doc.
https://rivet.ironcladapp.com/docs/api-reference/getting-started-integration
@kojikeneda I'll need more information about what's going wrong in order to help you. The docs page linked should have the instructions necessary to import
rivet-node
, and I've confirmed that it works in next.js. I welcome any PRs to add any next.js-specific integration docs!
If you have this working can we get examples? It's clear that Kojikeneda also couldn't get it working, and stating you got it working doesn't move the needle.
Basically I got as far as trying to get it working until I hit a wasm dep. I enabled the experimental support in next13 but never got it to work. Then from that point on of trying to get next13 to compile the wasm dependency it would just hand on compiling middle ware. If you can provide or I figure out a working example i'd be happy to contribute by working on the documentation.
@livingeek landed in the same spot from talking to him.
Just chiming in here to say that I also was unable to get the example code working as written due to the async issue.