I have this problem when I try to use the library for Golang "libretto" to instance VM from script
vm := &gcp.VM{
Name: "test-vm-2",
Zone: "us-central1-f",
MachineType: "n1-standard-1",
SourceImage: "centos-7-v20181011",
Disks: []gcp.Disk{
{
DiskType: "pd-standard",
DiskSizeGb: 10,
AutoDelete: true,
},
},
Preemptible: false,
Network: "default",
Subnetwork: "default",
UseInternalIP: false,
Project: os.Getenv(accountFile.ProjectID),
Scopes: []string {
"https://www.googleapis.com/auth/devstorage.read_write",
"https://www.googleapis.com/auth/logging.write",
},
AccountFile: "key.json",
SSHCreds: ssh.Credentials {
SSHUser: "VinCur",
SSHPrivateKey: accountFile.PrivateKey,
},
SSHPublicKey: pub_ssh,
}
This is the code...some solution?
Related
Hi I use the opensea api to create an offer but all it returns is a 400 Error with the message "Asset does not exist". Even though I use the same API before to retrieve the asset. I use the seaport SDK to create the signature and it all works fine
const { executeAllActions } = await seaport.createOrder(
{
offer: [
{
amount: basePrice.toString(),
token: WETH,
}
],
consideration: [item, ...considerationFeeItems],
endTime: endTime.toString(),
zone: DEFAULT_ZONE_BY_NETWORK[opensea.Network.Main],
restrictedByZone: true,
allowPartialFills: false,
conduitKey: CROSS_CHAIN_DEFAULT_CONDUIT_KEY,
counter: 0
},
ourAddress
);
const order = await executeAllActions();
But as soon as I send it to that endpoint https://docs.opensea.io/v2.0/reference/create-an-offer
it gives me back an error.
The order object returned from executeAllActions looks like following:
{
parameters: {
offerer: '0x...',
zone: '0x004c00500000ad104d7dbd00e3ae0a5c00560c00',
zoneHash: '0x3000000000000000000000000000000000000000000000000000000000000000',
startTime: '1660557986',
endTime: '1660644385',
orderType: 2,
offer: [ [Object] ],
consideration: [ [Object], [Object], [Object] ],
totalOriginalConsiderationItems: 3,
salt: '0xc532bab0fd9ae9529b4d8cfc9fc2f02e',
conduitKey: '0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000',
counter: 0
},
signature: '0x....'
}
What is going wrong?
Im using nuxtjs for a while. Before my last update all auth feature run smoothly.
But after I update the nuxt.config.js move axios plugin from plugins array to auth config object the error occurred. I need to put axios in auth config object because I need to access $auth from axios plugin.
Version
"#nuxtjs/auth-next": "5.0.0-1607693598.34d83ea"
"nuxt": "^2.15.2"
Nuxt configuration
Mode:
Universal
Nuxt configuration
auth: {
plugins: [{ src: "~/plugins/axios.js", ssr: true }], // <-- I put this, move from plugins array
strategies: {
local: {
token: {
property: "data.token",
required: true,
type: "",
maxAge: 18000,
},
user: {
property: "data",
autoFetch: true,
},
endpoints: {
login: { url: "/api/main", method: "post" },
logout: { url: "/api/profiles/logout", method: "get" },
user: { url: "/api/profile", method: "get" },
},
},
google: {
responseType: "code",
clientId:"<google client ID>",
codeChallengeMethod: "",
grantType: "authorization_code",
redirectUri: `${baseUrl}/verify-auth`,
},
},
redirect: {
login: "/login",
logout: "/login",
callback: "/login",
home: "/",
},
},
Reproduction
ExpiredAuthSessionError: Both token and refresh token have expired. Your request was aborted.
at a5d2e4e.js:1:4374
Steps to reproduce
After selecting a google account, then redirected to /verify-auth, then the error occurred. After /verify-auth it should go in.
Update google auth config like this:
google: {
responseType: "code",
clientId:"<google client ID>",
codeChallengeMethod: "",
grantType: "authorization_code",
redirectUri: `${baseUrl}/verify-auth`,
token: {
property: "data.token", // <-- based on your API response (endpints.login)
required: true,
type: "",
maxAge: 18000,
},
user: {
property: "data",
autoFetch: true,
},
endpoints: {
login: { url: "{your google auth API}", method: "post" }, // <-- should return response with token on it
logout: { url: "/api/profiles/logout", method: "get" },
user: { url: "/api/profile", method: "get" },
},
}
I am having trouble getting my API json results to be pushed into the Ember Data object model array. I was previously using getJSON on my route however I now need to be able to filter the data on multiple properties and Ember Data provides built in methods for that...if I could get it work that is. I'm pretty new to this so I am probably missing something terribly obvious. Please let me know if I am missing any code to assist. When I look at the promises, it shows them fulfilled when pulling the data from the API but then it rejects when trying to query the local data store for records (shows null) which I believe means my data isn't getting added to the store in the first place. I would provide a JSBin but our api uses CORS and I can't get the JSbin origin to authenticate.
On the route I have tried the following. Both throw different errors:
return this.store.find('restaurant');
//returns error: Error while processing route: casualdining
//Array.prototype.map: 'this' is null or undefined.
return DineSection.Restaurant.find();
//Error while processing route: casualdining
//Object doesn't support property or method 'find'
The Application Code:
DineSection = Ember.Application.create({
rootElement: "#dinesection-app"
});
DineSection.Router.map(function () {
this.resource("casualdining");
this.resource("restaurant", { path: "/:id" });
});
DineSection.ApplicationAdapter = DS.RESTAdapter.extend({
host: 'https://api.lakecountyfl.gov',
namespace: 'api/TourismListings',
pathForType: function (type) {
return "GetRestaurants";
}
});
DineSection.ApplicationStore = DS.Store.extend({
adapter: 'DineSection.ApplicationAdapter'
});
//SERIALIZE OUR JSON DATA FROM THE API into something ember data can use
DineSection.ApplicationSerializer = DS.RESTSerializer.extend({
normalizePayload: function (type, payload) {
return { restaurant: payload }
}
});
DineSection.Restaurant = DS.Model.extend({
name: DS.attr('string'),
address: DS.attr('string'),
city: DS.attr('string'),
zip: DS.attr('string'),
phone: DS.attr('string'),
website: DS.attr('string'),
facebook: DS.attr('string'),
flickr: DS.attr('string'),
hasphoto: DS.attr('boolean', {defaultValue: false}),
outdoordining: DS.attr('boolean', { defaultValue: false }),
breakfastprice: DS.attr('string'),
lunchprice: DS.attr('string'),
dinnerprice: DS.attr('string'),
description: DS.attr('string'),
primarycategoryname: DS.attr('string'),
primarycategoryslug: DS.attr('string'),
primarysubcategoryname: DS.attr('string'),
primarysubcategoryslug: DS.attr('string'),
foodtype: DS.attr('string'),
foodtypeid: DS.attr('number'),
ranking: DS.attr('number'),
region1: DS.attr('boolean', { defaultValue: false }),
region2: DS.attr('boolean', { defaultValue: false }),
region3: DS.attr('boolean', { defaultValue: false }),
region4: DS.attr('boolean', { defaultValue: false })
});
DineSection.CasualdiningRoute = Ember.Route.extend({
model: function () {
//return Ember.$.getJSON("https://devapi.lakecountyfl.gov/api/TourismListings/GetRestaurants");
return this.store.find('restaurant');
//return DineSection.Restaurant.find();
}
});
My JSON response looks like this (abbreviated to two records for simplicity):
[{
"$id": "1",
"id": 1212,
"name": "Al's Landing",
"address": "111 W. Ruby St.",
"city": "Tavares",
"zip": "32778",
"phone": "352-555-8585",
"website": "http://www.alslanding.com",
"facebook": "https://www.facebook.com/pages/ALS-landing/110275062350544",
"flickr": null,
"hasphoto": true,
"outdoordining": true,
"breakfastprice": "N/A",
"lunchprice": "$10-$20",
"dinnerprice": "$10-$20",
"description": "A casual dining atmosphere with an indoor/ outdoor bar and plenty of outdoor lakefront seating.",
"primarycategoryname": "Dining",
"primarycategoryslug": "dining",
"primarysubcategoryname": "Casual Dining",
"primarysubcategoryslug": "casualdining",
"foodtype": "American",
"foodtypeid": 13,
"ranking": 3,
"region1": false,
"region2": false,
"region3": true,
"region4": false
},
{
"$id": "2",
"id": 1026,
"name": "#1 Wok",
"address": "1080 E. Highway 50",
"city": "Clermont",
"zip": "34711",
"phone": "352-555-2346",
"website": "",
"facebook": "",
"flickr": "",
"hasphoto": false,
"outdoordining": false,
"breakfastprice": "N/A",
"lunchprice": "Less than $10",
"dinnerprice": "Less than $10",
"description": "",
"primarycategoryname": "Dining",
"primarycategoryslug": "dining",
"primarysubcategoryname": "Casual Dining",
"primarysubcategoryslug": "casualdining",
"foodtype": "Asian",
"foodtypeid": 1,
"ranking": 1,
"region1": false,
"region2": false,
"region3": false,
"region4": true
}
]
I think you need a 'root' key in your JSON like follows:
[ restaurants: {
at the moment I'm working on my first Sencha Touch Application and I run into a problem I spent lots of hours until now.
I tried to get the value from a cross domain Json to fill a nested list in my application.
When I run my code in browser everything works fine. The List is filled and I can call a detail view by tap on a leafitem.
But after building the sencha touch app with "sencha app build", I only get the following error in the browser console when starting the app.
TypeError: Ext.data is undefined
Ext.data.JsonP.callback1({ Here is the long valid JSON content });
I don't unterstand, why Ext.data is undefined. I would appreciate if someone could help me. I tried several solutions but I couldn't get this running.
These are the contents of my files:
Store:
Ext.define("Test.store.ExpStore", {
extend: "Ext.data.TreeStore",
requires: [
'Ext.data.JsonP'
],
config: {
model: "Test.model.ExpModel",
proxy: {
type: 'jsonp',
url: 'http://myurl/project/mylist.php',
callbackKey: 'callback',
reader: {
type: 'json',
rootProperty: 'experts'
}
}
}});
Model:
Ext.define('Test.model.ExpModel', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'name', type: 'string'},
{name: 'number', type: 'string'},
{name: 'active', type: 'boolean'}
]
}});
ListView:
Ext.define('Test.view.ExpListView', {
extend: 'Ext.NestedList',
alias: 'widget.expListView',
config: {
fullscreen: true,
title: "Experts",
displayField: 'name',
store: 'ExpStore',
}});
app.json
"js": [
{
"path": "touch/sencha-touch.js",
"x-bootstrap": true
},
{
"path": "bootstrap.js",
"x-bootstrap": true
},
{
"path": "app.js",
"bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */
"update": "delta"
}],
app.js
Ext.application({
name: 'Test',
requires: [
'Ext.MessageBox',
//'Ext.data.JsonP',
'Ext.data.*'
],
models: [
'ExpModel'
],
views: [
//'Main'
'ExpDetailsView',
'ExpListView'
],
controllers: [
'ExpController'
],
stores: [
'ExpStore'
],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon#2x.png',
'144': 'resources/icons/Icon~ipad#2x.png'
},
isIconPrecomposed: true,
startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
var expListView = {
xtype: 'expListView'
};
var expDetailsView = {
xtype: 'expDetailsView'
};
// Initialize the main view
Ext.Viewport.add(expListView, expDetailsView);
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}});
I'm trying to load a store from JSON received from webservices. But all the data from the JSON goes under the 'raw' column of the items in the store...
I can't figure out why, my code seems correct.
Any help is welcome.
My Model :
Ext.define('App.model.Node', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'id', type: 'int' },
{ name: 'version', type: 'int' },
{ name: 'user_id', type: 'int' },
{ name: 'tstamp', type: 'date' },
{ name: 'changeset_id', type: 'int' },
{ name: 'tags', type: 'string' },
{ name: 'geom', type: 'string'}
],
idProperty: 'id'
}
});
My Store :
Ext.define('App.store.NodeStore', {
extend: 'Ext.data.Store',
xtype: 'nodestore',
requires: [
'Ext.data.proxy.Rest'
],
config: {
model: 'App.model.Node',
storeId: 'nodeStore',
autoLoad: true,
proxy: {
type:'rest',
url:'http://localhost/server/nodes',
reader: {
type:'json',
rootProperty: 'nodes'
},
noCache: false,
limitParam: false,
headers: {
'Accept' : 'application/json'
}
}
}
});
My JSON :
{
"nodes": [
{
"id": "454467",
"version": 6,
"user_id": 52015,
"tstamp": "2008-12-27 21:38:45",
"changeset_id": "634766",
"tags": "",
"geom": "0101000020E6100000409CD1A0B29321405455682096804740"
},
{
"id": "454468",
"version": 8,
"user_id": 52015,
"tstamp": "2009-12-23 20:47:15",
"changeset_id": "3437205",
"tags": "",
"geom": "0101000020E6100000357C0BEBC69321409EC02ACD9C804740"
},
{
"id": "454469",
"version": 7,
"user_id": 52015,
"tstamp": "2009-12-23 20:47:15",
"changeset_id": "3437205",
"tags": "",
"geom": "0101000020E6100000347914F8D4932140B8BBBD5AA4804740"
}
]
}
And when I do a
var nodeStore = Ext.getStore('nodeStore');
nodeStore.load();
console.log(nodeStore.getData());
we can see the following object, with my data in the raw column under items...
I figured it out, my code is correct and the only thing missing is a callback in the load() function :
nodeStore.load({
callback: function(records, operation, success) {
console.log(records);
console.log(nodeStore.getCount());
nodeStore.each(function(element) {
console.log(element.data.id);
});
},
scope: this,
});
The problem was I was trying to access the store before it loaded the data. Now I'm waiting that all the data is loaded to access it, and it works.