Set the platform to 64 bit in ARM template - azure-resource-manager

I have the following arm template:
resource functionApp 'Microsoft.Web/sites#2018-02-01' = {
name: name
location: location
kind: kind
properties: {
serverFarmId: resourceId('Microsoft.Web/serverfarms', servicePlanName)
clientAffinityEnabled: false
httpsOnly: true
siteConfig: {
appSettings: secretSettings
}
}
identity: {
type: 'SystemAssigned'
}
}
I need to set the platform to 64 bit. On updating this to:
resource functionApp 'Microsoft.Web/sites#2018-02-01' = {
name: name
location: location
kind: kind
properties: {
serverFarmId: resourceId('Microsoft.Web/serverfarms', servicePlanName)
clientAffinityEnabled: false
httpsOnly: true
siteConfig: {
appSettings: secretSettings
use32BitWorkerProcess : false
}
}
identity: {
type: 'SystemAssigned'
}
}
I see it failing. What am I missing?

As you have not shared any error details , So there is only solution As the MS DOC provided by #evgeny, you can use the below template and deploy it as well.
for example:-
use32BitWorkerProcess : bool // If need to enable 64 , provide false as value
TEMPLATE :-
resource symbolicname 'Microsoft.Web/sites#2018-02-01' = {
name: 'string'
location: 'string'
tags: {
tagName1: 'tagValue1'
tagName2: 'tagValue2'
}
kind: 'string'
identity: {
type: 'string'
userAssignedIdentities: {}
}
properties: {
clientAffinityEnabled: bool
clientCertEnabled: bool
clientCertExclusionPaths: 'string'
cloningInfo: {
appSettingsOverrides: {}
cloneCustomHostNames: bool
cloneSourceControl: bool
configureLoadBalancing: bool
correlationId: 'string'
hostingEnvironment: 'string'
overwrite: bool
sourceWebAppId: 'string'
sourceWebAppLocation: 'string'
trafficManagerProfileId: 'string'
trafficManagerProfileName: 'string'
}
containerSize: int
dailyMemoryTimeQuota: int
enabled: bool
geoDistributions: [
{
location: 'string'
numberOfWorkers: int
}
]
hostingEnvironmentProfile: {
id: 'string'
}
hostNamesDisabled: bool
hostNameSslStates: [
{
hostType: 'string'
name: 'string'
sslState: 'string'
thumbprint: 'string'
toUpdate: bool
virtualIP: 'string'
}
]
httpsOnly: bool
hyperV: bool
isXenon: bool
redundancyMode: 'string'
reserved: bool
scmSiteAlsoStopped: bool
serverFarmId: 'string'
siteConfig: {
alwaysOn: bool
apiDefinition: {
url: 'string'
}
appCommandLine: 'string'
appSettings: [
{
name: 'string'
value: 'string'
}
]
autoHealEnabled: bool
autoHealRules: {
actions: {
actionType: 'string'
customAction: {
exe: 'string'
parameters: 'string'
}
minProcessExecutionTime: 'string'
}
triggers: {
privateBytesInKB: int
requests: {
count: int
timeInterval: 'string'
}
slowRequests: {
count: int
timeInterval: 'string'
timeTaken: 'string'
}
statusCodes: [
{
count: int
status: int
subStatus: int
timeInterval: 'string'
win32Status: int
}
]
}
}
autoSwapSlotName: 'string'
azureStorageAccounts: {}
connectionStrings: [
{
connectionString: 'string'
name: 'string'
type: 'string'
}
]
cors: {
allowedOrigins: [
'string'
]
supportCredentials: bool
}
defaultDocuments: [
'string'
]
detailedErrorLoggingEnabled: bool
documentRoot: 'string'
experiments: {
rampUpRules: [
{
actionHostName: 'string'
changeDecisionCallbackUrl: 'string'
changeIntervalInMinutes: int
changeStep: int
maxReroutePercentage: int
minReroutePercentage: int
name: 'string'
reroutePercentage: int
}
]
}
ftpsState: 'string'
handlerMappings: [
{
arguments: 'string'
extension: 'string'
scriptProcessor: 'string'
}
]
http20Enabled: bool
httpLoggingEnabled: bool
ipSecurityRestrictions: [
{
action: 'string'
description: 'string'
ipAddress: 'string'
name: 'string'
priority: int
subnetMask: 'string'
subnetTrafficTag: int
tag: 'string'
vnetSubnetResourceId: 'string'
vnetTrafficTag: int
}
]
javaContainer: 'string'
javaContainerVersion: 'string'
javaVersion: 'string'
limits: {
maxDiskSizeInMb: int
maxMemoryInMb: int
maxPercentageCpu: int
}
linuxFxVersion: 'string'
loadBalancing: 'string'
localMySqlEnabled: bool
logsDirectorySizeLimit: int
managedPipelineMode: 'string'
managedServiceIdentityId: int
minTlsVersion: 'string'
netFrameworkVersion: 'string'
nodeVersion: 'string'
numberOfWorkers: int
phpVersion: 'string'
publishingUsername: 'string'
push: {
kind: 'string'
properties: {
dynamicTagsJson: 'string'
isPushEnabled: bool
tagsRequiringAuth: 'string'
tagWhitelistJson: 'string'
}
}
pythonVersion: 'string'
remoteDebuggingEnabled: bool
remoteDebuggingVersion: 'string'
requestTracingEnabled: bool
requestTracingExpirationTime: 'string'
reservedInstanceCount: int
scmIpSecurityRestrictions: [
{
action: 'string'
description: 'string'
ipAddress: 'string'
name: 'string'
priority: int
subnetMask: 'string'
subnetTrafficTag: int
tag: 'string'
vnetSubnetResourceId: 'string'
vnetTrafficTag: int
}
]
scmIpSecurityRestrictionsUseMain: bool
scmType: 'string'
tracingOptions: 'string'
use32BitWorkerProcess: bool
virtualApplications: [
{
physicalPath: 'string'
preloadEnabled: bool
virtualDirectories: [
{
physicalPath: 'string'
virtualPath: 'string'
}
]
virtualPath: 'string'
}
]
vnetName: 'string'
webSocketsEnabled: bool
windowsFxVersion: 'string'
xManagedServiceIdentityId: int
}
}
}

Related

Argument userId: Got invalid value '5106220' on Prisma.findManyTodos. Provided String, expected IntFilter or Int:

using next.js +next-auth + Prisma + PostgreSQL
I added a custom login page and added the providers as well.
my userId in the database is Int so when I log in with credentials I have no issue but when logging in with one of the social providers I get an error...
Argument userId: Got invalid value '5106220' on Prisma.findManyTodos. Provided String, expected IntFilter or Int:
how to force providers to use Int instead of String when connecting to a database.
This error occurs whenever i need to connect the database
This is a Full error
provider: {
id: 'facebook',
name: 'Facebook',
type: 'oauth',
authorization: {
url: 'https://www.facebook.com/v11.0/dialog/oauth',
params: [Object]
},
token: {
url: 'https://graph.facebook.com/oauth/access_token',
params: {}
},
userinfo: {
url: 'https://graph.facebook.com/me',
params: [Object],
request: [AsyncFunction: request]
},
profile: [Function: profile],
idToken: false,
checks: [ 'state' ],
clientId: 'MyClientId',
clientSecret: '413db228b5b8e2e1134f5',
signinUrl: 'http://localhost:3000/api/auth/signin/facebook',
callbackUrl: 'http://localhost:3000/api/auth/callback/facebook'
}
}
[next-auth][debug][PROFILE_DATA] {
OAuthProfile: {
id: '11062270',
name: 'obi ',
email: 'ow1#gmail.com',
picture: { data: [Object] }
}
}
[next-auth][debug][OAUTH_CALLBACK_RESPONSE] {
profile: {
id: '5062260',
name: ' Eco',
email: 'ow1#gmail.com',
image: 'https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=570&height=50&width=50&e&hash=AeR6hTT03RbzF9Z9hkg'
},
account: {
provider: 'facebook',
type: 'oauth',
providerAccountId: '0711062270',
access_token: 'EAAVmjxtUcOMBACPeAQm3Ocb0zzKcl8uiZAnZCYhhYxGo',
token_type: 'bearer',
expires_at: 1669548134
},
OAuthProfile: {
id: '560',
name: 'co',
email: 'ow1#gmail.com',
picture: { data: [Object] }
}
}
{
user: {
name: 'co',
email: 'ow1#gmail.com',
image: 'https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=5007110622680570&height=50&width=50&ext=1666977090&hash=AeR6hTT03RbzF9Z9hkg',
id: '106226'
},
expires: '2022-10-28T17:11:31.515Z',
id: '1062'
}
PrismaClientValidationError:
Invalid `prisma.todos.findMany()` invocation:
{
where: {
userId: '7110620'
~~~~~~~~~~~~~~~~~~
},
select: {
id: true,
text: true,
done: true
}
}
Argument userId: Got invalid value '5106220' on prisma.findManyTodos. Provided String, expected IntFilter or Int:
type IntFilter {
equals?: Int
in?: List<Int>
notIn?: List<Int>
lt?: Int
lte?: Int
gt?: Int
gte?: Int
not?: Int | NestedIntFilter
}
type IntFilter {
equals?: Int
in?: List<Int>
notIn?: List<Int>
lt?: Int
lte?: Int
gt?: Int
gte?: Int
not?: Int | NestedIntFilter
}
at Document.validate (C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:29297:20)
at serializationFn (C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:31876:19)
at runInChildSpan (C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:25100:12)
at PrismaClient._executeRequest (C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:31883:31)
at consumer (C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:31810:23)
at C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:31815:51
at AsyncResource.runInAsyncScope (node:async_hooks:201:9)
at C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:31815:29
at runInChildSpan (C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:25100:12)
at PrismaClient._request (C:\Users\elear\Desktop\TokTok4u\node_modules\#prisma\client\runtime\index.js:31812:22) {
clientVersion: '4.4.0'
}
API resolved without sending a response for /api/v1/todo/get, this may result in stalled requests.
According to the Prisma adapter in the NextAuth docs, the User model in the Prisma schema needs to have an id field with a String type.
You must add + before the field.
Example +id or +productId and try again.
This helps me resolve my problem.

How can I pattern-match items pulled from a DashMap?

I am trying to pattern match on an enum when getting an item from my dashmap::DashMap. However, it looks like they have a wrapper type over the Entity when they return the data. How can I pattern match over the items then?
use once_cell::sync::Lazy;
use dashmap::DashMap;
enum Entity {
Person { name: String },
Animal { name: String },
}
static ENTITIES: Lazy<DashMap<usize, Entity>> = Lazy::new(|| DashMap::new());
fn main() {
ENTITIES.insert(
0,
Entity::Animal {
name: "pikachu".into(),
},
);
ENTITIES.insert(
1,
Entity::Person {
name: "trainer mike".into(),
},
);
match ENTITIES.get(&0) {
Some(Entity::Animal { name }) => { // compile error here
println!("found animal: {}", name);
}
_ => panic!("did not find person"),
}
}
And the error:
error[E0308]: mismatched types
--> src\lib.rs:__:__
|
| match ENTITIES.get(&0) {
| -------------- this expression has type `Option<dashmap::mapref::one::Ref<'_, usize, Entity>>`
| Some(Entity::Animal { name }) => {
| ^^^^^^^^^^^^^^^^^^^^^^^ expected struct `dashmap::mapref::one::Ref`, found enum `Entity`
|
= note: expected struct `dashmap::mapref::one::Ref<'_, usize, Entity, >`
found enum `Entity`

Missing type annotation for 'U'

The following code works fine but I'm getting a Flow error for it:
case UPDATE_USER: {
return {
...state,
users: state.users.map((user) => {
if (user.id === action.id) {
return {...user, [action.propName]: action.payload};
} else {
return user;
}
})
};
}
The exact message is this:
<U>(
callbackfn: (
value: User,
index: number,
array: Array<User>
) => U,
thisArg?: any
) => Array<U>
any
Missing type annotation for `U`. `U` is a type parameter declared in function type [1] and was implicitly instantiated at call of method `map` [2].Flow(InferError)
I suspect the problem might be related to the way I've defined my Action types for the Reducer:
type ToggleModalAction = {type: typeof TOGGLE_MODAL};
type CancelRequestAction = {type: typeof CANCEL_REQUEST, payload: boolean};
type UpdateCompanyAction = {type: typeof UPDATE_COMPANY, payload: number};
type ResetStateAction = {type: typeof RESET_STATE};
type AddUserAction = {type: typeof ADD_USER, isDirty: boolean};
type UpdateUserAction = {type: typeof UPDATE_USER, id: number, propName: string, payload: string | number};
type RemoveUserAction = {type: typeof REMOVE_USER, id: number};
I've tried several things to resolve it but none work. Any ideas?
It seems that you need to provide the return value for map
case UPDATE_USER: {
return {
...state,
users: state.users.map((user): User => {
if (user.id === action.id) {
return {...user, [action.propName]: action.payload};
} else {
return user;
}
})
};
}

AppSync batch insert to DynamoDB fails and returns null

I have the following resolver settings:
#set($questions = [])
#foreach($item in ${ctx.args.questions})
#set($item.id = $util.dynamodb.toDynamoDBJson($util.autoId()))
$util.qr($questions.add($util.dynamodb.toMapValues($item)))
#end
{
"version" : "2018-05-29",
"operation" : "BatchPutItem",
"tables" : {
"QuestionTable": $utils.toJson($questions)
}
}
And the following GraphQL schema:
input CreateQuestionInput {
text: String
sectionId: ID!
}
input CreateScoreInput {
score: Int!
questionId: ID!
userId: ID!
}
input CreateSectionInput {
title: String
subSection: String
}
input DeleteQuestionInput {
id: ID!
}
input DeleteScoreInput {
id: ID!
}
input DeleteSectionInput {
id: ID!
}
type Mutation {
...
createQuestion(input: CreateQuestionInput!): Question
batchCreateQuestion(questions: [CreateQuestionInput]!): [Question]
}
type Query {
getSection(id: ID!): Section
listSections(filter: TableSectionFilterInput, limit: Int, nextToken: String): SectionConnection
getScore(id: ID!): Score
listScores(filter: TableScoreFilterInput, limit: Int, nextToken: String): ScoreConnection
getQuestion(id: ID!): Question
listQuestions(filter: TableQuestionFilterInput, limit: Int, nextToken: String): QuestionConnection
}
type Question {
id: ID!
text: String
sectionId: ID!
}
type QuestionConnection {
items: [Question]
nextToken: String
}
type Schema {
query: Query
}
type Score {
id: ID!
score: Int!
questionId: ID!
userId: ID!
}
type ScoreConnection {
items: [Score]
nextToken: String
}
type Section {
id: ID!
title: String
subSection: String
questions: [Question]
}
type SectionConnection {
items: [Section]
nextToken: String
}
input TableQuestionFilterInput {
id: TableIDFilterInput
text: TableStringFilterInput
sectionId: TableIDFilterInput
}
input UpdateQuestionInput {
id: ID!
text: String
sectionId: ID
}
(I've redacted some of the schema as it was fairly large).
When I attempt to run the query:
mutation BatchCreateQuestions($sec: ID!) {
batchCreateQuestion(questions: [
{
text: "Tester 1"
sectionId: $sec
},
{
text: "Tester 2",
sectionId: $sec
}
]) {
id
text
sectionId
}
}
With the variables:
{ "sec": "abc123" }
I get the response:
{
"data": {
"batchCreateQuestion": [
null,
null
]
}
}
And when I check the DynamoDB table, it hasn't saved the values. I've granted full dynamodb permissions for this datasource, but still no joy.
Turns out I'd given batch write permissions to a similarly named role instead of the role affecting this data source. If you see a similar issue, check your IAM roles/permissions. Silly me.
What does your response template look like in the resolver? It should be $util.toJson($ctx.result.data.QuestionTable) based on the above table name being QuestionTable as that gets automatically translated into the response context.

Apollo/GraphQL: Setting Up Resolver for String Fields?

In GraphiQL at http://localhost:8080/graphiql, I'm using this query:
{
instant_message(fromID: "1"){
fromID
toID
msgText
}
}
I'm getting this response:
{
"data": {
"instant_message": {
"fromID": null,
"toID": null,
"msgText": null
}
},
"errors": [
{
"message": "Resolve function for \"instant_message.fromID\" returned undefined",
"locations": [
{
"line": 3,
"column": 5
}
]
},
{
"message": "Resolve function for \"instant_message.toID\" returned undefined",
"locations": [
{
"line": 4,
"column": 5
}
]
},
{
"message": "Resolve function for \"instant_message.msgText\" returned undefined",
"locations": [
{
"line": 5,
"column": 5
}
]
}
]
}
I tried to set up my system according to the examples found here:
https://medium.com/apollo-stack/tutorial-building-a-graphql-server-cddaa023c035#.s7vjgjkb7
Looking at that article, it doesn't seem to be necessary to set up individual resolvers for string fields, but I must be missing something.
What is the correct way to update my resolvers so as to return results from string fields? Example code would be greatly appreciated!
Thanks very much in advance to all for any thoughts or info.
CONNECTORS
import Sequelize from 'sequelize';
//SQL CONNECTORS
const db = new Sequelize(Meteor.settings.postgres.current_dev_system.dbname, Meteor.settings.postgres.current_dev_system.dbuser, Meteor.settings.postgres.current_dev_system.dbpsd, {
host: 'localhost',
dialect: 'postgres',
});
db
.authenticate()
.then(function(err) {
console.log('Connection to Sequelize has been established successfully.');
})
.catch(function (err) {
console.log('Unable to connect to the Sequelize database:', err);
});
const IMModel = db.define('IM', {
id: {type: Sequelize.INTEGER, primaryKey: true, autoIncrement: true},
fromID: {type: Sequelize.STRING},
toID: {type: Sequelize.STRING},
msgText: {type: Sequelize.STRING}
});
IMModel.sync({force: true}).then(function () {
// Table created
return IMModel.create({
fromID: '1',
toID: '2',
msgText: 'msg set up via IMModel.create'
});
});
const IM = db.models.IM;
export {db, IM };
SCHEMA
const typeDefinitions = [`
type instant_message {
id: Int
fromID: String
toID: String
msgText: String
}
type Query {
instant_message(fromID: String, toID: String, msgText: String): instant_message
}
type RootMutation {
createInstant_message(
fromID: String!
toID: String!
msgText: String!
): instant_message
}
schema {
query: Query,
mutation: RootMutation
}
`];
export default typeDefinitions;
RESOLVERS
import * as connectors from './db-connectors';
import { Kind } from 'graphql/language';
const b = 100;
const resolvers = {
Query: {
instant_message(_, args) {
const a = 100;
return connectors.IM.find({ where: args });
}
},
RootMutation: {
createInstant_message: (__, args) => { return connectors.IM.create(args); },
},
};
export default resolvers;
When you define your GraphQLObjectTypes you need to provide a resolver for each of their fields.
You defined your instant_message with multiple fields but did not provide resolvers for each of these fields.
More over you defined the types of those field with regular typescript fields while you need to define it with GraphQL types (GraphQLInt, GraphQLString, GrapQLFloat etc..)
So defining your type should look something like this:
let instant_message = new GraphQLObjectType({
id: {
type: GraphQLInt,
resolve: (instantMsg)=> {return instantMsg.id}
}
fromID: {
type: GraphQLString,
resolve: (instantMsg)=> {return instantMsg.fromID}
}
toID: {
type: GraphQLString,
resolve: (instantMsg)=> {return instantMsg.toID}
}
msgText: {
type: GraphQLString,
resolve: (instantMsg)=> {return instantMsg.msgText}
}
})
In addition, you will need to define your Query as follows:
let Query = new GraphQLObjectType({
name: "query",
description: "...",
fields: () => ({
instant_messages: {
type: new GraphQLList(instant_message),
args: {
id: {type: GraphQLInt}
},
resolve: (root, args) => {
connectors.IM.find({ where: args })
}
}
})
})
The issue is that the query does not expect an array,
Please fix it:
type Query {
instant_message(fromID: String, toID: String, msgText: String): [instant_message]
}
Then you should make sure the resolver returns Array of objects, if it doesnt work then the resolver is not returning an Array.

Resources