-
Notifications
You must be signed in to change notification settings - Fork 39
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
default-env.json -> VError: Could not parse default-env.json: Unexpected token � in JSON at position 0 #3
Comments
I don't see anything unusual in my default-env.json: I generally create my by cutting and pasting the service binding details from the cockpit or using the hana-cli serviceKey command https://github.com/SAP-samples/hana-developer-cli-tool-example#servicekey If you are cutting and pasting from a readme file maybe you are inadvertently picking up some extra formatting or something. |
Hi Thomas, PS C:\git\t3e\db> hana-cli serviceKey Wasn't sure with the Input Values. Maybe this is the reason for this error? |
Works with both but defaults to Cloud Foundry. Just use the -c option and set it to false when working with XSA. |
Thanks, a lot! Creating the default-env.json file works as you said with -c false. Now I run in this issue: Will close this issue. Thanks for your help! |
Sorry, I missed the step to create a hdi-container before. Was stupid, tried always to connect with a wrong hdi-container. Because I did this always by using the WebIDE, I want to do this also locally this time. But I run in this permission issue: Connection Problems: Error: insufficient privilege: Detailed info for this error can be found with guid '9C2AF86356F73742A12FCDFE90F93F92' It seems, that the problem are missing privileges. Usually I'm able to do this with my user by using the WebIDE. Do I need different privileges? Thanks for your help! |
ok, I think I found it. Developing with HANA Deployment Infrastructure (HDI) without XSA |
Help me understand what's going wrong for you. You create the container with the xs create-service command. and then use the serviceKey command of the hana-cli to create the default-env.json. If you want to create the container with the hana-cli createContainer you can do so. That command was designed for systems that don't have XSA or CF available and you want to use HDI via its Stored Procedure APIs only. You don't get a service instance, so this isn't good for when you want to bind a module to the container. Its good for HDI/DB only scenarios. However it should work as well but you need a very powerful user in the default-env-admin.json configuration. Something similar to the SYSTEM user but also has HDI admin privileges. Because technical user is going to act as the HDI broker and needs to have the authorizations to call the HDI stored procedures. If you don't want to setup such an HDI admin user or you need to bind your HDI container to a service then you are better off using the xs create-service command to create the HDI container. |
thanks for your clarification. I still try to create the bookshop hdi-container without xsa. I was looking for this kind of code, to get the whole permissions for creating the hdi-container.
But even after granting this permissions, I do get the error msg, that the admin role is missing.
Yes, I can set this role by myself, but did I something wrong? |
Is there a way to get a list of all XSA instances like for HANA Cloud? hana-cli hdi |
I was missing two role grants in the XSA environment when creating the HDI Admin users via adminHDI or adminHDIGroup commands. I've fixed that in the latest version (2.202105.3) which I just released to npm. If you upgrade you should be good now. I tested in my local HANA Express instance. First login as SYSTEM or similar super user: With that connection create an HDI Admin user: The credentials aren't saved locally by default, so connect again but this time with the new HDI Admin user you just created. Use the createContainer command with the -a switch to run the command as the HDI Admin user (stored in the default-env-admin.json file locally) When this command is complete it will write the container technical users into a default-env.json file (alongside the default-env.-admin.json) for local development. Most commands can now be issued without the -a switch but still have that option to run as the HDI Admin in special cases. But deploy and all other commands generally should run as the container technical users now. status command -a is running as HDITEST3 (the HDI Admin user we created) and status is running as the container technically user created when the container was created. |
after npm install -g hana-cli Read once that only the owner of the npm can fix this problem.
|
Got it solved after running all this commands in this order. |
Thanks a lot. Got it to work. Coud create a container locally without XSA. :) There is still one question. Whats with spaces? Does them not relevant in the non-XSA world? |
|
hdbsql is a separate tool You can install it via the HANA Client installation from here: https://tools.hana.ondemand.com/#hanatools |
hi Thomas, PS C:\git\dr-sap-tech-bytes\db> hana-cli serviceKey -c false Thanks! |
hana-cli ups shows user provided services. HANA HDI would not be a User Provided Service but a normal service. You seem be getting the cf version of the API as well. Try --cf false and see if that works. But still the User Provided Service isn't the right option for this. You would instead use hana-cli hdi or you can of course always use cf services or xs services. |
hana-cli serviceKey -cf false --> doesn't work Connection Problems: the same as above |
It's --cf not -cf for option in the hana-cli hdi comand xs services doesn't work? I don't understand what you mean by you didn't assign it to a space. |
PS C:\git\dr-sap-tech-bytes\db> hana-cli hdi --cf false The /v3/ cf curl error? --> yes
xs services --> works |
to get sure, the same (without false) |
thanks for clarifying this! this helps me a lot!
Compared with your values, I miss this value on my side hana-cli c: 'false',
|
Your version is 2.202105.3. But 2.202105.4 is the latest and the version where i introduced the new xs support for hdi and ups commands. https://github.com/SAP-samples/hana-developer-cli-tool-example/blob/main/CHANGELOG.md#22021054
|
yes it works. thanks!!! Only wondering that I don't see the hdi services from the containers which I created yesterday.
|
Yes there is a limit and I didn't put a parameter in to control it. Do you have hundreds of container instances? I kind of assumed that space wouldn't have hundreds of instances, but if I'm off base then I'll have to add some control of the limit and maybe some pagination of the results for performance. |
yes, round about 140 in our dev space. sorry! :) |
OK - I'll add a backlog item to add pagination. :) |
Hi Thomas, I'm struggling still with the serviceKey command. "SyntaxError: Unexpected end of JSON input"
The hdi-container is there:
I was able to create a service-key for my hdi-container with XS command Could it be that I need a different structured default-env-admin.json file for hdi-services which were created with WebIDE? I use this:
hana-cli status -a woks fine so far. |
This error is now complaining about the default-env-admin.json but actually the content coming out of the xs service command. The above content - did that all come from one command? Because at the beginning I see an input of service key TESTQAY PS C:\git\t3e\db> hana-cli serviceKey --cf false But later in the error I see a different service key of ASFSD: Getting service key "ASFSD" for service instance "DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container" ... Service key "ASFSD" for service instance "DIRASCHK-xqqrzopj5lywap2p-tbase-hdi-container" not found. Does your service key exist before using the hana-cli serviceKey command? You need to use an existing service key in order to read the details. It isn't that the command creates a serviceKey. |
Was my misunderstanding, I thought it will create a hdi-service-key and a default-env.json file together.!
|
I'm afraid not. In order to access the service credentials you need to know an existing service instance and key name. Without that I can't access the credentials. Although now that you mention it, I suppose I could make two calls - one to create a new key and then one to use that key to retrieve the credentials. I'd never thought about it that way before. I'll add that as a future enhancement request. |
Hi @jung-thomas, if I try to build my new generated views, I get this error msg:
I think the issue is that the word PATIENTVIEW is capitalized and I don't know why. |
No HDBVIEW doesn't require all capital names, but I generally use them because I know that CAP does require all capitals. So although you are written PatientView in the CDS entity it will be converted to PATIENTVIEW going into the database. This is why you need hdbviews to covert the existing DB artifact naming to all caps to make CAP CDS happy. Now your hdbview should be able to support projecting over another DB object that doesn't have all caps, but you will need to put quotes around the name otherwise HANA also converts it to all upper case. You said that you tried quotes but ran into other issues? What were those? You'll definitely need to use quotes at the hdbview level if your target object has mixed case. |
So if you put "PaientView" in the hdbview name like that then CAP CDS will NOT be able to use it. Although you use entity![PatientView] that entity will be translated to PATIENTVIEW when it tries to go to the underlying DB. Therefore you should name PatientView.hdbview as PATIENTVIEW. |
From the CAP help: _Plain Names Quoted Names In this case, it’s necessary to introduce an additional database object (a synonym or a view) on top of the existing database object and construct the facade entity for this newly introduced mapping object_ |
Hello experts,
maybe one of you may help me.
I try to follow your nice youtube video for local development without WebIDE, but struggling this time with the db default-env.json file.
Get this error msg: VError: Could not parse default-env.json: Unexpected token � in JSON at position 0
I'm able to use the same file in an older different project and do not get this issue.
Tried now this project with Node 10.x and Node 14.x but it fails with the same issue.
Took the original default-env.json template from the hdi-deploy readme but there is no difference.
this is the beginning of my file:
![image](https://user-images.githubusercontent.com/4199123/117567564-f96de080-b0bc-11eb-80c7-18f786a5d526.png)
after reading the file by fs I can see the question marks at the beginning
![image](https://user-images.githubusercontent.com/4199123/117567261-bbbc8800-b0bb-11eb-80f1-c448432b335b.png)
and throws an error, because of this question marks
![image](https://user-images.githubusercontent.com/4199123/117567182-38029b80-b0bb-11eb-9a71-5d3fae5b5259.png)
Would be nice if one of you has an idea to solve this issue.
thanks for your advice!
The text was updated successfully, but these errors were encountered: