Closed rajdip-b closed 1 month ago
/attempt
Assigned the issue to @Meeran-Tofiq!
Hello @rajdip-b, I hope you're doing well.
Regarding this issue I've had a lot of difficulty in setting up the CLI to make it work for development. First, it said there were issues with it finding @keyshade/api-client
. I had to do run a pnpm run build
command in packages/api-client
to make it work. This was not mentioned in the docs. Then another error came up, which also needed the same command to be ran in packages/secret-scan
for @keyshade/secret-scan
. This I also could not find in the docs for setting up the cli for development.
Currently, another problem has occurred that I haven't been able to solve:
It says index.js doesn't exist in keyshade/apps/cli/dist/index.js
. But there is an index.js file in keyshade/apps/cli/dist/src/index.js
:
I'm leaving this comment for a few main reasons:
First, I may have missed where it is documented to fully set up the cli for development. I have only come across this one: If I have missed it, I'd appreciate being pointed to the correct one.
If however I haven't missed it, I think it would make sense to create a few issues on the github repo to address these problems.
I'd also appreciate being guided, if there is no other documentation option, on how to actually set it up for development.
Thank you very much.
Hey man, we are really sorry about this trouble you faced. I have to admit, it was a very tough job for us to set up multiple package dependency. With the scripts changing in nearly every push, it was even more difficult to manage. But in #451, I have worked on all the fixes. I intend to merge it by tonight. Expect the CLI docs to be updated aswell.
Again, sorry about the inconvenience.
Oh, I see. No worries man you guys are doing an amazing job, don't sweat it. I enjoy working on open-source and I understand these are some issues that come with it. Seriously don't sweat it. Thanks for the kind and timely response as always! :)
and looking forward to see the new docs for it XD
Hey! Gladly, I could make all the updates right away. Please have a read and let me know if you were able to get the CLI up and running following the docs.
After following the updated docs, I still get the following issue that I don't understand:
It says index.js
doesn't exist in keyshade/apps/cli/dist/index.js
. But there is an index.js
file in keyshade/apps/cli/dist/src/index.js
:
Edited to add the command I wrote:
pnpm dev:cli -- keyshade workspace list
Okay, for one, you command is a bit wrong. It will be pnpm dev:cli -- workspace list
. Secondly, it's odd what you are facing. I'll try replicate the same on my device.
EDIT: You can join our discord channel to discuss this better imo.
Okay, I just tried deleting my build folder, and running the command. Seems like it worked. Perhaps, you can try running pnpm build:cli
and running it again?
After messing around a bit, I got it working almost. Now it gives a different error: Error: ENOENT: no such file or directory, open '/home/meeran/.keyshade/profiles.json'
Does this mean I have to install keyshade on my machine even though I have the entire source code on my machine?
Also, I'm sorry for not using discord for the discussions, I will from now on use it after I complete this issue. Thanks for your help so far XD
After messing around a bit, I got it working almost. Now it gives a different error:
Error: ENOENT: no such file or directory, open '/home/meeran/.keyshade/profiles.json'
Does this mean I have to install keyshade on my machine even though I have the entire source code on my machine?
Also, I'm sorry for not using discord for the discussions, I will from now on use it after I complete this issue. Thanks for your help so far XD
We didn't know this error still persisted! We put up a fix for it a long back. Anyways, you can just create a .keyshade
folder in /home/meeran
and add a file named profiles.json
in there. I'll test this again myself to see what went wrong.
I tried removing and recreating my fork and set everything up again. It did not work, and still gives the same issue. When I make a fake .keyshade/profiles.json
file, it throws an error saying SyntaxError: Unexpected end of JSON input
. I don't know how to proceed further. Is it only an issue on my pc and therefore I should solve it? Or is it a bug in keyshade itself? If the latter, then what should I do? As I have had this issue assigned to me for a long time with no progress, should be unassigned on it so I can work on other things?
Thanks.
I strongly believe it's an issue on our end. Could you just add a {} in your json file? It should solve the issue. Meanwhile, you can also open up an issue regarding the problems you are facing. Someone might pick that up. I myself couldn't get the time to look into the issue.
Hello.
I apologize for the frequent pinging but I have tried a lot to get it to work myself. Now that I've put the empty brackets ({}
) inside the .keyshade/profiles.json
, I could run commands now. But then I had to make a profile, and put an api-key into it, which I used some random characters for it. Then when I wanted to make a workspace, it said my api key is invalid. I can't get this part to work. The keyshade website doesn't seem to work with the free plan
. More specifically, the Get Started
button isn't working. I tried to put in some fake api key, and it just throws an error saying that it's invalid. I'm a bit confused as to why I need an api key for development, I think it may be related to the fact that it is trying to read ~/.keyshade/profiles.json
whenever I try to run it on development mode when it isn't supposed to.
Once again, I apologize for the frequent pinging, I just can't seem to get this to work :sob:.
If you want to move this conversation to Discord, I will send this message with a more proper explanation of my issue in the collaborators channel on the keyshade Discord.
Thanks.
Hey! We really promote the ask-frequently culture so no worries!
Yes, we don't have any way to interact using the UI. All of these interactions are done via Postman. You would need to use this for now. And, there's no pricing involved. The postman API has detailed docs regarding how to get authenticated and make your requests. You would then need to create an API key from API Key Controller.
Please reach back to us in case you run into any trouble.
Thanks, I really appreciate it.
Regarding the postman though, I have setup my smtp server correctly and the api even sent me an email correctly. I reset it just in case and reran it to make sure, and it recreated the admin user and everything seems fine. However, when I try to send an OTP email from the postman, I get the following error:
{
"message": "The user has signed up with a different authentication provider.",
"error": "Unauthorized",
"statusCode": 401
}
I'd also like to note, that I got the email and it said taht I can sign up now:
Hello there!
Your admin account has been setup. Please login to your account for further process.
Your email is: <<my email>>
Thank you for choosing us.
Best Regards,
keyshade Team
But I did not Login
, as I do not know what the means in this context. Is there a command for me to login? Am I supposed to be getting a 401 error until I login?
thanks.
I think if you are logging in as the admin user, you would need to use the password that was provided to you. Ideally you shouldn't use the admin user.
If you are logging in using your personal email, use the Send OTP endpoint to send an OTP to your email address. This will automatically create your user. Then you need to Validate OTP. This will send you a jwt token which gets set into your cookies.
Next up, you can call the endpoints. You would need to use the Update Self endpoint to set isOnboardjngFinished to true before you do anything though.
Hope that helps.
I finally got it to work! Thank you so much for all your help, now I can finally start development... :sweat_smile:
A couple of notes regarding why it took me so long though, and I'll be blunt, is that the documentation is not great. Here are a few of my recommendations, which if you find reasonable, I would turn into issues:
ADMIN_EMAIL=your@email.com
. This made me think that I have to put in my own email address. When I did, it made the admin user have my email. This is why the issue was occurring where I would try to get the OTP email, but it said the user with this email is configured to validate with a different method. Specifically, this one:{ "message": "The user has signed up with a different authentication provider.", "error": "Unauthorized", "statusCode": 401 }
I only go the hint that I messed up at that part from your latest comment. Although it is not stated in the Environment Variables
section of the docs that I need to fill the ADMIN_EMAIL
field, so it was ultimately my own stupidity, though I do think just in case others make this mistake of mine, it should be mentioned or clarified.
Anyway, I really appreciate all the time it took for all the hand holding I needed. Thank you very much. I will be off now to actually implement the issue at last. Sorry for taking so long XD
Oh, and one more thing. Should i make new tests for the new commands?
thx
Oh, and one more thing. Should i make new tests for the new commands?
thx
Nah, we haven't implemented CLI testing yet. Just make sure that the commands work as expected and we would be good to go.
First, in the .env.example, it says ADMIN_EMAIL=your@email.com. This made me think that I have to put in my own email address. When I did, it made the admin user have my email. This is why the issue was occurring where I would try to get the OTP email, but it said the user with this email is configured to validate with a different method. Specifically, this one:
We can definitely improve the ADMIN_EMAIL
docs to explain this even better I admit.
Second, I didn't know I had to go through all those validation steps to work on the app itself. In the docs it is only mentioned that you guys are currently using Postman. I admit, I didn't check it because I was sure I didn't need to, and that was short-sighted of me. But, I do believe it would save you guys a lot of time from solving people like I's issues. I'm a beginner, and it was hard for me to set it up. I think it'd be great if it was mentioned in the docs.
I get the problem, but what I don't get is, where do we add these steps. We would need to add tutorials for these I believe. But then again, things are bound to change real quick. So Im not sure if those tutorials would give long term value or not.
:tada: This issue has been resolved in version 2.6.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Description
We would like to perform the following operations for workspace roles using our CLI:
keyshade workspace role list <workspaceSlug>
)keyshade workspace role get <workspaceRoleSlug>
)keyshade workspace role delete <workspaceRoleSlug>
)keyshade workspace role update <workspaceRoleSlugs> [refer postman for options]
)Solution
role.workspace.ts
undersrc/commands/workspace
command.interface.ts
and name itWorkspaceRoleCommand
workspace.command.ts
src/commands/workspace/role
.workspaceRoleController
underControllerInstance
to make the API calls.