Skip to content
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

ERROR: LaunchInstance #482

Open
remotejob opened this issue Feb 21, 2024 · 7 comments
Open

ERROR: LaunchInstance #482

remotejob opened this issue Feb 21, 2024 · 7 comments

Comments

@remotejob
Copy link

{"availabilityDomain":"ocid1.availabilitydomain.oc1..aaaaaaaaluor6lyhbyxbd5dbpmcsytcidprtrzmzmuf5hydnprk5aze7ik3a","compartmentId":"ocid1.tenancy.oc1..aaaaaaaahabf4ecjpejw4ukcpsh7j5un4bw5shr3fekfnus5fdtfdw4pl3xq","createVnicDetails":{"subnetId":"ocid1.subnet.oc1.eu-amsterdam-1.aaaaaaaaomfzlqotps7ldxk2o445vdwpvt5ofq7nnglhtbwx5l35tpkbwtzq"},"displayName":"OCI-Sample-Instance","shape":"VM.Standard.E2.1.Micro","sourceDetails":{"imageId":"ocid1.image.oc1.eu-amsterdam-1.aaaaaaaanjwra5zb2djwkkimdydl6im3f5mtzcb657nw3ky4huoj5sc5tioa","sourceType":"image"}}

{ "code" : "CannotParseRequest", "message" : "Incorrectly formatted request. Please refer to our documentation for help." }

Test was based on

https://github.com/oracle/oci-go-sdk/blob/master/example/example_core_test.go

@JoshuaWR
Copy link
Member

Hi @remotejob, are you still facing this issue? After running that example locally I did not receive a "CannotParseRequest" error. Looking at the API Documentation, this request appears to be formatted correctly as well. Which version of the SDK are you using?

@colussim
Copy link

Hi , I have exactly the same error as @remotejob using the same example, or a similar code.I use the latest version of the sdk and the version go 1.23.2 or 1.23.3.I am under Mac OS 15.0.1

@JoshuaWR
Copy link
Member

@colussim Currently we only officially support Golang up to version 1.21. While that probably isn't the issue here, you might want to try downgrading your Golang if possible, and seeing if that helps. Also, could you share the full debug log?

@colussim
Copy link

Hi @JoshuaWR , below is the log with version go 1.23, I've slightly modified the ExampleLaunchInstance() function so that it doesn't create the subnet and uses an existing subnet.I'm having the test redone with a version of go 1.21

INFO 2024/11/26 12:20:31.286255 log.go:106: logger level set to: 1
INFO 2024/11/26 12:20:31.286874 eventual_consistency.go:76: (pid=47889, gid=1) OCI_GO_SDK_EC_CONFIG: Unknown ec mode '', assuming 'inprocess'
INFO 2024/11/26 12:20:31.286919 log.go:106: logger level set to: 1
INFO 2024/11/26 12:20:31.293803 oci_http_transport_wrapper.go:41: Loading tls config from TLSConfigProvider
INFO 2024/11/26 12:20:31.769588 client.go:459: Dump Request POST /20160918/instances HTTP/1.1
Host: iaas.us-ashburn-1.oraclecloud.com
User-Agent: Oracle-GoSDK/65.79.0 (darwin/arm64; go/go1.23.3)
Content-Length: 359
Accept: /
Authorization: Signature version="1",headers="date (request-target) host content-length content-type x-content-sha256",keyId="ocid1.tenancy.oc1..aaaaaaaa4yet6xypq5khquqhozb7rja2cwomj4zvpxvqgusrnojr3t5rieiq/ocid1.user.oc1..aaaaaaaaw6azc4qqqeh7ti2ebg6ofqgyntfw5477gehmhmhslk6fx6d2cwoa/b9:a6:1d:6b:fd:e6:e5:b4:5a:07:92:a0:1d:94:17:38",algorithm="rsa-sha256",signature="IrT6p4cB+nahAGQPcrw4zKeAnudcSin25VzGE9rXaNLDguQcDKXR9c333KITyMy33YQGgzjuUsBLzmTmJ/T7mPbDL4wympxrxexeQpXa1oVgHE/nUF086aBiBySYDZFBFl7UCttoTYySJDwJqPtEaGBKcXOBLDnwt9KeJDbV9cZJTOcxzQjnaIyyEV/BHn3tvFVsg5P+bcL6ifGmCHbcj5m2Dec+Yvfc+10YZ/0es0QBwrlTIgoAI9Eck/Hq7Bi/eg8/C0QIFW+7rz68MQ6lreL2cAUcKXflO4AMOrBfVx8Q6oGEym9bGHz1Ib6t3ZEpAL1knxG0REkgzBS5xdisPw=="
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:31 GMT
Opc-Client-Info: Oracle-GoSDK/65.79.0
Opc-Client-Retries: true
Opc-Request-Id: 0ab57b2299b6d99667e60c0ef7796048
Opc-Retry-Token: 00bFoSqlD8bjrMWygEBYjgs8pl6r4dTv
X-Content-Sha256: FxIMd1ia0I29pkeL9j9zwjz8EO+YKfpul1/MK2nsP/M=
Accept-Encoding: gzip

INFO 2024/11/26 12:20:31.769809 log.go:229: Dump Request Body:
{"availabilityDomain":"","compartmentId":"","createVnicDetails":{"subnetId":"ocid1.image.oc1.phx.aaaaaaaaoxcvvajxk2redbtizhxcame3bdb7zmbkkykbrhnymsgl4wmuoyla"},"displayName":"OCI-Sample-Instance","shape":" VM.Standard.E5.Flex","sourceDetails":{"imageId":"ocid1.image.oc1.iad.aaaaaaaaqvfr266g4fhtm2lod3sx3m4evkkeviermbkl7c35djsfqchhvdxq","sourceType":"image"}}
INFO 2024/11/26 12:20:31.769964 client.go:465: Dump Response HTTP/1.1 400 Bad Request
Content-Length: 127
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:31 GMT
Opc-Request-Id: 0ab57b2299b6d99667e60c0ef7796048/E46B46F5CB17482F99BBE50C66129D88/FB89411F89A65E101F2BB1ED94814F77
Strict-Transport-Security: max-age=31536000; includeSubDomains;

{
"code" : "CannotParseRequest",
"message" : "Incorrectly formatted request. Please refer to our documentation for help."
}
INFO 2024/11/26 12:20:33.120473 client.go:459: Dump Request POST /20160918/instances HTTP/1.1
Host: iaas.us-ashburn-1.oraclecloud.com
User-Agent: Oracle-GoSDK/65.79.0 (darwin/arm64; go/go1.23.3)
Content-Length: 359
Accept: /
Authorization: Signature version="1",headers="date (request-target) host content-length content-type x-content-sha256",keyId="ocid1.tenancy.oc1..aaaaaaaa4yet6xypq5khquqhozb7rja2cwomj4zvpxvqgusrnojr3t5rieiq/ocid1.user.oc1..aaaaaaaaw6azc4qqqeh7ti2ebg6ofqgyntfw5477gehmhmhslk6fx6d2cwoa/b9:a6:1d:6b:fd:e6:e5:b4:5a:07:92:a0:1d:94:17:38",algorithm="rsa-sha256",signature="JJ1UVXRS6NXG0vXL+aa9/13hrogh9hw8k9s7PQ3n3EwoTXvOLShYuxiZq3rnv6QIUHXVj7qFsCET7zxJ9cH7agNwOBH4da/uHu0xBk1xFVqPJ40s98b9EUZ7VkhGS+aucvt11NlhYdOwPQ+GUEZv2MWqf2EMIg6KBlsK7PlsPX8ma5EHtVVPMxuwtG9J5ETPfItZrV8TXEkvMG9Rr9+ZWeScz2KpulZ8LDiHwNIZCqIvrkuFHs4zZO1u0ZDWm2RKpIvKMDTzPOtID1sRCJht9r1MhYI/Jsga6wDk0anJ9Aqnb0CLjQXmajJkXBUEkhqPkLdKgN5CAySjRIhu5A8q0g=="
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:33 GMT
Opc-Client-Info: Oracle-GoSDK/65.79.0
Opc-Client-Retries: true
Opc-Request-Id: 8db04f7c9be8340656b7c27bc3d72aef
Opc-Retry-Token: 00bFoSqlD8bjrMWygEBYjgs8pl6r4dTv
X-Content-Sha256: FxIMd1ia0I29pkeL9j9zwjz8EO+YKfpul1/MK2nsP/M=
Accept-Encoding: gzip

INFO 2024/11/26 12:20:33.120768 log.go:229: Dump Request Body:
{"availabilityDomain":"","compartmentId":"","createVnicDetails":{"subnetId":"ocid1.image.oc1.phx.aaaaaaaaoxcvvajxk2redbtizhxcame3bdb7zmbkkykbrhnymsgl4wmuoyla"},"displayName":"OCI-Sample-Instance","shape":" VM.Standard.E5.Flex","sourceDetails":{"imageId":"ocid1.image.oc1.iad.aaaaaaaaqvfr266g4fhtm2lod3sx3m4evkkeviermbkl7c35djsfqchhvdxq","sourceType":"image"}}
INFO 2024/11/26 12:20:33.120948 client.go:465: Dump Response HTTP/1.1 400 Bad Request
Content-Length: 127
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:33 GMT
Opc-Request-Id: 8db04f7c9be8340656b7c27bc3d72aef/87742209687E6192497844343157AE7F/81D1B8FEEF58DDFF4EC07ADC0F3BA320
Strict-Transport-Security: max-age=31536000; includeSubDomains;

{
"code" : "CannotParseRequest",
"message" : "Incorrectly formatted request. Please refer to our documentation for help."
}
INFO 2024/11/26 12:20:35.388512 client.go:459: Dump Request POST /20160918/instances HTTP/1.1
Host: iaas.us-ashburn-1.oraclecloud.com
User-Agent: Oracle-GoSDK/65.79.0 (darwin/arm64; go/go1.23.3)
Content-Length: 359
Accept: /
Authorization: Signature version="1",headers="date (request-target) host content-length content-type x-content-sha256",keyId="ocid1.tenancy.oc1..aaaaaaaa4yet6xypq5khquqhozb7rja2cwomj4zvpxvqgusrnojr3t5rieiq/ocid1.user.oc1..aaaaaaaaw6azc4qqqeh7ti2ebg6ofqgyntfw5477gehmhmhslk6fx6d2cwoa/b9:a6:1d:6b:fd:e6:e5:b4:5a:07:92:a0:1d:94:17:38",algorithm="rsa-sha256",signature="IX9zuB/fAmgiwbsLq++qAGTM14b7hcPNUNeu8yEtxcxoPHjwLrmOhaNxYv+kJmykra0xIevkz03UYNOkCjvcJ6MfYfVRFR5EPNGa5WS46FFgntxqXQfSOVfdTsFU7ESEdQYzYRBEOvJsMXAyBqkfzcm1YpuRHd4ZTrR3MFsqkOuQa+LMDlOa3vi/ymKQPjyYWlixz/w8MYFL/wBMTyiizTdigUPZ8jOR843WnlqgWeoFq/9KL2YXaya3duRP/DWziiwS0F2Rqpsl7MRSBg4QrDMWv7BxWwSq0f5kvJxBzJJqKCuyvxEdZynBzQsmzmiE321s1o6zLi+Rk8BH3LCLFg=="
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:35 GMT
Opc-Client-Info: Oracle-GoSDK/65.79.0
Opc-Client-Retries: true
Opc-Request-Id: 6fbd9a63cd5c9e23d11d59f7a6d91c66
Opc-Retry-Token: 00bFoSqlD8bjrMWygEBYjgs8pl6r4dTv
X-Content-Sha256: FxIMd1ia0I29pkeL9j9zwjz8EO+YKfpul1/MK2nsP/M=
Accept-Encoding: gzip

INFO 2024/11/26 12:20:35.388762 log.go:229: Dump Request Body:
{"availabilityDomain":"","compartmentId":"","createVnicDetails":{"subnetId":"ocid1.image.oc1.phx.aaaaaaaaoxcvvajxk2redbtizhxcame3bdb7zmbkkykbrhnymsgl4wmuoyla"},"displayName":"OCI-Sample-Instance","shape":" VM.Standard.E5.Flex","sourceDetails":{"imageId":"ocid1.image.oc1.iad.aaaaaaaaqvfr266g4fhtm2lod3sx3m4evkkeviermbkl7c35djsfqchhvdxq","sourceType":"image"}}
INFO 2024/11/26 12:20:35.388920 client.go:465: Dump Response HTTP/1.1 400 Bad Request
Content-Length: 127
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:35 GMT
Opc-Request-Id: 6fbd9a63cd5c9e23d11d59f7a6d91c66/9A87AA0A2720AD077A4B5A09C6650D5C/3BD4B1C241F36DCAE579AA7027D5DE71
Strict-Transport-Security: max-age=31536000; includeSubDomains;

{
"code" : "CannotParseRequest",
"message" : "Incorrectly formatted request. Please refer to our documentation for help."
}
INFO 2024/11/26 12:20:40.045180 client.go:459: Dump Request POST /20160918/instances HTTP/1.1
Host: iaas.us-ashburn-1.oraclecloud.com
User-Agent: Oracle-GoSDK/65.79.0 (darwin/arm64; go/go1.23.3)
Content-Length: 359
Accept: /
Authorization: Signature version="1",headers="date (request-target) host content-length content-type x-content-sha256",keyId="ocid1.tenancy.oc1..aaaaaaaa4yet6xypq5khquqhozb7rja2cwomj4zvpxvqgusrnojr3t5rieiq/ocid1.user.oc1..aaaaaaaaw6azc4qqqeh7ti2ebg6ofqgyntfw5477gehmhmhslk6fx6d2cwoa/b9:a6:1d:6b:fd:e6:e5:b4:5a:07:92:a0:1d:94:17:38",algorithm="rsa-sha256",signature="KDtfJR2NIQv/y6NcbYG/6vA/es3n2LAWIqsgqQ1qnHuYSF/Kmcr/sTqO5kSQVIQo1Mk3lMvB/Sq4UbA9mwZE4GLyQETbfRS3887rXbcTW/t6pO1MXoaHYD0DzrYWoZNFZtN2B0zC1KEzXdxGSBTHasucTiwrEhdSSUb8gGgad/MlBChaz7Lg5I8Kmx7NuATX5yXz877fov5SCZ33+ktVufpPI+2a7cgc2XAzD298FsK3rCf/zjm3fkBJjfhh5G4lov7JFnc7hZh7bSwa8PsMUFComw5wsZoB0f6rF89mLW9w/B6D9mluc//I4gj4Jurti664bxNVPyhK9LJCXeXGVA=="
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:39 GMT
Opc-Client-Info: Oracle-GoSDK/65.79.0
Opc-Client-Retries: true
Opc-Request-Id: 424e550941097f67cec92a7f25dd6431
Opc-Retry-Token: 00bFoSqlD8bjrMWygEBYjgs8pl6r4dTv
X-Content-Sha256: FxIMd1ia0I29pkeL9j9zwjz8EO+YKfpul1/MK2nsP/M=
Accept-Encoding: gzip

INFO 2024/11/26 12:20:40.045460 log.go:229: Dump Request Body:
{"availabilityDomain":"","compartmentId":"","createVnicDetails":{"subnetId":"ocid1.image.oc1.phx.aaaaaaaaoxcvvajxk2redbtizhxcame3bdb7zmbkkykbrhnymsgl4wmuoyla"},"displayName":"OCI-Sample-Instance","shape":" VM.Standard.E5.Flex","sourceDetails":{"imageId":"ocid1.image.oc1.iad.aaaaaaaaqvfr266g4fhtm2lod3sx3m4evkkeviermbkl7c35djsfqchhvdxq","sourceType":"image"}}
INFO 2024/11/26 12:20:40.045599 client.go:465: Dump Response HTTP/1.1 400 Bad Request
Content-Length: 127
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:40 GMT
Opc-Request-Id: 424e550941097f67cec92a7f25dd6431/005FF18761D4931573DCE9943DE7D20C/34B0535165F6470CFA9123A33F5FFD77
Strict-Transport-Security: max-age=31536000; includeSubDomains;

{
"code" : "CannotParseRequest",
"message" : "Incorrectly formatted request. Please refer to our documentation for help."
}
INFO 2024/11/26 12:20:49.060764 client.go:459: Dump Request POST /20160918/instances HTTP/1.1
Host: iaas.us-ashburn-1.oraclecloud.com
User-Agent: Oracle-GoSDK/65.79.0 (darwin/arm64; go/go1.23.3)
Content-Length: 359
Accept: /
Authorization: Signature version="1",headers="date (request-target) host content-length content-type x-content-sha256",keyId="ocid1.tenancy.oc1..aaaaaaaa4yet6xypq5khquqhozb7rja2cwomj4zvpxvqgusrnojr3t5rieiq/ocid1.user.oc1..aaaaaaaaw6azc4qqqeh7ti2ebg6ofqgyntfw5477gehmhmhslk6fx6d2cwoa/b9:a6:1d:6b:fd:e6:e5:b4:5a:07:92:a0:1d:94:17:38",algorithm="rsa-sha256",signature="KlngEAVqQDiVaiVsl8icyT3b3xOK1G9m6Ii+V7MM0Sa6IQwyc6jBdRdlrAzKlkHTtSZnYQCVfO+Kq8tAH8PnisnynGqB5fP1h3lxXH4PHjv+wiSNB8PXfKz7+75GfUElUYsijiz5nUmAVjy6Njq6cvQ5ZTy2QCpVieX+1aJzyJTxVZ+cQ0bZ2qcRiPVVIiuNs8sUpyzRm6gwveZ6mOKtGvBA5vJ+9kVMFOegNlkeyTnMSGplujV0Kb6zqWGuPpqardWzcAGV0F2CYEzglOMWV+CY3PbfpT045lU8vyaSPyrUL9FFi5+dQbjgampbPctUChsnIS2vsWQvAJTt63fL+Q=="
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:48 GMT
Opc-Client-Info: Oracle-GoSDK/65.79.0
Opc-Client-Retries: true
Opc-Request-Id: d5d183c7d3958f1e29e9c3a7fadcb220
Opc-Retry-Token: 00bFoSqlD8bjrMWygEBYjgs8pl6r4dTv
X-Content-Sha256: FxIMd1ia0I29pkeL9j9zwjz8EO+YKfpul1/MK2nsP/M=
Accept-Encoding: gzip

INFO 2024/11/26 12:20:49.060899 log.go:229: Dump Request Body:
{"availabilityDomain":"","compartmentId":"","createVnicDetails":{"subnetId":"ocid1.image.oc1.phx.aaaaaaaaoxcvvajxk2redbtizhxcame3bdb7zmbkkykbrhnymsgl4wmuoyla"},"displayName":"OCI-Sample-Instance","shape":" VM.Standard.E5.Flex","sourceDetails":{"imageId":"ocid1.image.oc1.iad.aaaaaaaaqvfr266g4fhtm2lod3sx3m4evkkeviermbkl7c35djsfqchhvdxq","sourceType":"image"}}
INFO 2024/11/26 12:20:49.060984 client.go:465: Dump Response HTTP/1.1 400 Bad Request
Content-Length: 127
Content-Type: application/json
Date: Tue, 26 Nov 2024 11:20:49 GMT
Opc-Request-Id: d5d183c7d3958f1e29e9c3a7fadcb220/412646ADA84FC7AD637EE98483541803/FAC60D501F899CA6DB3F3AE05A5833ED
Strict-Transport-Security: max-age=31536000; includeSubDomains;

{
"code" : "CannotParseRequest",
"message" : "Incorrectly formatted request. Please refer to our documentation for help."
}

@colussim
Copy link

Hi @JoshuaWR ,I tested with the go 1.21 version and got the same error.😥

@JoshuaWR
Copy link
Member

JoshuaWR commented Dec 2, 2024

Thanks for trying out go 1.21. Could you share the snippet of code that is generating this error? There are a number of steps in the example (creating/getting the subnet, launching the instance, attaching the vnic) and I am trying to determine which of these steps is failing. I'm unsure of what exactly the request is from the request body, as it includes Vnic info similar to the AttachVnic request, but it also includes some extra fields that are not part of that request (such as source details).
If you could share the piece of code that you modified as well that may help determine what the problem is. Thank you

@colussim
Copy link

colussim commented Dec 4, 2024

Hi @JoshuaWR the code used for the test :
``
package main

import (
"context"
"fmt"
"log"

"github.com/oracle/oci-go-sdk/v65/common"
"github.com/oracle/oci-go-sdk/v65/core"
"github.com/oracle/oci-go-sdk/v65/example/helpers"

)
func main() {
provider := common.DefaultConfigProvider()

// ID of the compartment where the VM will be created
compartmentID := "ocid1.tenancy.oc1..aaaaaaaa4......."

//  Image ID
imageID := "ocid1.image.oc1.iad.aaaaaaaaqvfr266g4fhtm2lod3sx3m4evkkeviermbkl7c35djsfqchhvdxq"

//ID of the subnet where the VM will be created
subnetID := "ocid1.image.oc1.phx.aaaaa..."
//shape := "VM.Standard.A1.Flex"
shape := "VM.Standard2.4"

client, err := core.NewComputeClientWithConfigurationProvider(provider)
if err != nil {
	fmt.Println("Error creating Compute client:", err)
	return
}

// Define instance details
instanceDetails := core.LaunchInstanceDetails{
	CompartmentId: common.String(compartmentID),
	DisplayName:   common.String("VM01"), 
	Shape:         common.String(shape),
	SourceDetails: core.InstanceSourceViaImageDetails{
		ImageId: common.String(imageID),
	},
	CreateVnicDetails: &core.CreateVnicDetails{
		SubnetId:       common.String(subnetID),
		AssignPublicIp: common.Bool(true), 
	},
	Metadata: map[string]string{
		"ssh_authorized_keys": "ssh-rsa xxxxx", 
	},
}

// Preparing the request
launchRequest := core.LaunchInstanceRequest{
	LaunchInstanceDetails: instanceDetails,
}

// Launch instance
response, err := client.LaunchInstance(context.Background(), launchRequest)
if err != nil {
	fmt.Println("Error during instance creation:", err)
	return
}

// View details of the VM created
fmt.Printf("VM successfully created !\nID: %s\nName: %s\n", *response.Instance.Id, *response.Instance.DisplayName)

}

``
Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants