BigQuery insert error, state: pending, status code 5 - google-app-engine

I am having bigquery insert error, which I can not find any solution to fix. I am doing stream insert using nodejs using google app engine. The error does not occur every time though. The log of the error is given as:
{
insertId: "j5hzu8e36yg0"
logName: "projects/xxxx-xxxx/logs/cloudaudit.googleapis.com%2Fdata_access"
protoPayload: {
#type: "type.googleapis.com/google.cloud.audit.AuditLog"
authenticationInfo: {
principalEmail: "xxxx-xxxx#appspot.gserviceaccount.com"
}
authorizationInfo: [
0: {
granted: true
permission: "bigquery.jobs.create"
resource: "projects/xxxx-xxxx"
}
]
methodName: "jobservice.getqueryresults"
requestMetadata: {
callerIp: "xx.xx.xx.xx"
callerSuppliedUserAgent: "gcloud-dotnet/1.0.0-beta18 google-api-dotnet-client/1.35.1.0 (gzip),gzip(gfe)"
}
resourceName: "projects/xxxx-xxxx/queries/job_bc378dc9_240d_4caf_acfa_d54691ffe595"
serviceData: {
#type: "type.googleapis.com/google.cloud.bigquery.logging.v1.AuditData"
jobGetQueryResultsRequest: {
}
jobGetQueryResultsResponse: {
job: {
jobConfiguration: {
}
jobName: {
}
jobStatistics: {
}
jobStatus: {
error: {
}
state: "PENDING"
}
}
}
}
serviceName: "bigquery.googleapis.com"
status: {
code: 5
message: "Not found: Job xxxx-xxxx:job_bc378dc9_240d_4caf_acfa_d54691ffe595"
}
}
receiveTimestamp: "2018-11-22T07:24:42.323436659Z"
resource: {
labels: {
project_id: "xxxx-xxxx"
}
type: "bigquery_resource"
}
severity: "ERROR"
timestamp: "2018-11-22T07:24:41.794Z"
Let me know if you need further information.

It looks like BigQuery is unable to find the geographic location of the job.
Make sure to specify your region in the location property in the jobReference. Here is an github example for nodejs that you can consult.
UPDATE
Check if the job that was not found was retried and successfully done. In streaming it needs a delay between requesting the job and try to retrieving it. So you can ignore such errors and give it a second try to get info.

Related

How to determine in URQL if data is returned from cache or server

For example, I have:
query {
authors {
id
name
twitterHandler
}
}
And:
query {
posts {
id
author {
id
name
twitterHandler
}
body
title
}
}
I do these requests sequentially and synchronously. My question is, will URQL get author entity of post from cache ? If yes, how to determine it ? Are there any logs on console or devtools which says: "This part I got from cache" ?
P.S. I am using graphcache
Assume this is your query;
const [result] = useQuery({
query: <QUERY-NAME>,
variables: {
<VARIABLES>,
},
})
By examining following property path:
result.operation.context you will see the following where is the information you look for.
I wonder what is the use case for this?
{
"url": "/path/to/graphql",
"preferGetMethod": false,
"requestPolicy": "network-only",
"suspense": false,
"meta": {
"cacheOutcome": "miss" <- HERE
}
}

Sequelize Op.like and Op.or failing

i have this issue with Sequelize:
I'm trying to have a 3 parameter research and if one of those parameter is empty it should not consider that parameter.
const users = await User.findAll({
where: {
category: { [Op.like]: `%${req.query.category}%` },
location: { [Op.like]: `%${req.query.location}%` },
[Op.or]: [
{ job: { [Op.like]: `%${req.query.job}%` } },
{ bio: { [Op.like]: `%${req.query.job}%` } },
{ skills: { [Op.like]: `%${req.query.job}%` } },
],
},
attributes: { exclude: ['password', 'createdAt', 'updatedAt'] },
})
I've found out that the [Op.like] is not working anywhere.
It only works if a parameter is empty (blocks that parameter from filtering the users and that's something i like).
When i do a research with the example payload {category:'Information Technology', job:'frontend web dev', location:'Sydn'} this is logged in the process log:
Executing (default): SELECT `id`, `email`, `firstName`, `lastName`, `image`, `location`, `phone`,
`website`, `availability`, `category`, `job`, `skills`, `bio` FROM `Users` AS `User`
WHERE (`User`.`job` LIKE '%frontend web dev%' OR `User`.`bio` LIKE '%frontend web dev%' OR
`User`.`skills` LIKE '%frontend web dev%') AND `User`.`category` LIKE '%Information Technology%'
AND `User`.`location` LIKE '%Sydn%';
but no user is found. (yes, in the database I have users with similar parameters)
In my opinion your code and your logged SQL are same. I don't see any errors. Maybe you should try to copy that SQL and paste it in MySQL Workbench (if you're using MySQL) then try to run it.
I think it should looks more like this:
category: { [Op.like]: '%`${req.query.category}%`' },
What I did here is add single quote mark '. Reference to the documentation

Getting error: "You provided an invalid object where a stream was expected" without react-native debugger

I'm a newbie and I have the code provided below which work excellent with react-native debugger connected, but without the debugger, I'm getting the error. Error connected to that line:
return from((execute(link, operation) as unknown) as Subscribable<GraphQLResponse<{ login: User }>>)
.pipe(responseInterceptor('login'));
But I don't know how to fix it.
Full code of my request:
login(userInput: LoginInput) {
const operation = {
query: gql`
mutation Login($userInput: LoginInput) {
login(input: $userInput) {
_id
authToken
email
status
}
}
`,
variables: { userInput },
};
return from((execute(link, operation) as unknown) as Subscribable<GraphQLResponse<{ login: User }>>)
.pipe(responseInterceptor('login'));
}

Field 'name' on type 'RemoteDependencyData' is too long

I've just added Application Insights to my React application. When it attempts to contact the Application Insights server to notify it about Google Adverts loading, I get a 400 error which says: "Field 'name' on type 'RemoteDependencyData' is too long"
I've looked through the config for ApplicationInsights and don't find a way to shorten the name or to ignore certain fetches.
Here is my configuration of the plugin:
initialize(reactPluginConfig) {
const instrumentationKey = publicRuntimeConfig.AppInsights.InstrumentKey
this.appInsights = new ApplicationInsights({
config: {
instrumentationKey,
maxBatchInterval: 0,
disableFetchTracking: false,
extensions: [this.reactPlugin],
extensionConfig: {
[this.reactPlugin.identifier]: reactPluginConfig
}
}
})
this.appInsights.loadAppInsights()
}
Here's the kind of value I'm seeing being passed:
name: "GET https://securepubads.g.doubleclick.net/gampad/ads?gdfp_req=1&pvsid=3899864230170460&correlator=1176166438184394&output=json_html&callback=googletag.impl.pubads.callbackProxy3&impl=fifs&adsid=AGt39rSWeAHAYcWHd55Pv2v0Hn4qiAL6Sl5QTuM8A7Vy0061-z2dWmbQdMXwo-8N5G4e1e5VaGTTm0lLSoER&jar=2019-6-18-23&json_a=1&eid=21063203%2C21063317%2C22316438&vrg=2019061301&guci=2.2.0.0.2.2.0.0&plat=1%3A32776%2C2%3A32776%2C8%3A32776&sc=0&sfv=1-0-33&ecs=20190618&iu_parts=12671339%2Caa_sbdept_bottom_728x90&enc_prev_ius=0%2F1&prev_iu_szs=728x90&prev_scp=department%3Dbody-armor%26category%3DBody%2520Armor%2520%2526%2520Protection&cookie_enabled=1&bc=31&abxe=1&lmt=1560900694&dt=1560900694440&dlt=1560900618064&idt=11742&frm=20&biw=2543&bih=400&oid=3&adxs=1244&adys=2379&adks=1434505235&ucis=d&ifi=9&u_tz=-420&u_his=4&u_h=1440&u_w=2560&u_ah=1440&u_aw=2560&u_cd=24&u_nplug=3&u_nmime=4&u_sd=1&flash=0&url=http%3A%2F%2Flocalhost%3A3000%2Fdepartment%2F10A56330.aspx&dssz=15&icsg=48955391&std=20&vis=2&dmc=8&scr_x=0&scr_y=0&psz=728x90&msz=728x90&blev=0.98&bisch=1&ga_vid=1753854358.1560900630&ga_sid=1560900630&ga_hid=551901891&fws=0"
You can add this telemetry initializer below your call to loadAppInsights to modify your telemetry items on the fly. In this case, it will truncate the RemoteDependencyData name field.
appInsights.addTelemetryInitializer(item => {
if (item.baseType === 'RemoteDependencyData') {
if (item.baseData.name.length > 1024) {
item.baseData.name = item.baseData.name.substr(0, 1024);
}
}
});

Removing an object from an array inside a Collection

I'm using the following methods to push and pull objects into the "following" array, which is a property on each user's profile.
Meteor.users.update({ _id: this.userId }, { $push: {
"profile.following": { _id: _id, service: service, type: type }}
});
// I specify that it is required to match these two properties to remove an object
Meteor.users.update({ _id: this.userId }, { $pull: {
"profile.following": { service: service, type: type } }
});
This approach does work, it removes the object, but I always get this error:
Exception while simulating the effect of invoking 'unfollow' Error: documentMatches needs a document {stack: (...), message: "documentMatches needs a document"} Error: documentMatches needs a document
at Error (native)
at _.extend.documentMatches (http://localhost:3000/packages/minimongo.js?e8806aa7782b729b2517ebc0cd10b321667f1427:1341:13)
at MODIFIERS.$pull (http://localhost:3000/packages/minimongo.js?e8806aa7782b729b2517ebc0cd10b321667f1427:3414:24)
at http://localhost:3000/packages/minimongo.js?e8806aa7782b729b2517ebc0cd10b321667f1427:3124:9
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:22)
at http://localhost:3000/packages/minimongo.js?e8806aa7782b729b2517ebc0cd10b321667f1427:3105:9
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:164:22)
at Function.LocalCollection._modify (http://localhost:3000/packages/minimongo.js?e8806aa7782b729b2517ebc0cd10b321667f1427:3098:7)
at LocalCollection._modifyAndNotify (http://localhost:3000/packages/minimongo.js?e8806aa7782b729b2517ebc0cd10b321667f1427:848:19)
at http://localhost:3000/packages/minimongo.js?e8806aa7782b729b2517ebc0cd10b321667f1427:765:12
I'm not sure if this is a bug with Meteor or if I maybe I'm not writing the query correctly.
Apparent $elemMatch is needed to do this:
Meteor.users.update({ _id: this.userId }, { $pull: {
"profile.following": { $elemMatch: { service: service, type: type } } }
});

Resources