GraphQL build error when deploying at Vercel - graphql

I'm trying to deploy my Nextjs app to Vercel, I am using strapi backend deployed at Heroku...
Unfortunately I am stuck at this build error at Vercel....
I have googled and tried to find a solution but unfortunately I can't and have no idea what to do.
Any ideas appreciated....
> Build error occurred
Error: Unexpected token M in JSON at position 0
at new ApolloError (/vercel/path0/node_modules/#apollo/client/errors/errors.cjs:34:28)
at /vercel/path0/node_modules/#apollo/client/core/core.cjs:1595:19
at both (/vercel/path0/node_modules/#apollo/client/utilities/utilities.cjs:986:53)
at /vercel/path0/node_modules/#apollo/client/utilities/utilities.cjs:979:72
at new Promise (<anonymous>)
at Object.then (/vercel/path0/node_modules/#apollo/client/utilities/utilities.cjs:979:24)
at Object.error (/vercel/path0/node_modules/#apollo/client/utilities/utilities.cjs:987:49)
at notifySubscription (/vercel/path0/node_modules/zen-observable/lib/Observable.js:140:18)
at onNotify (/vercel/path0/node_modules/zen-observable/lib/Observable.js:179:3)
at SubscriptionObserver.error (/vercel/path0/node_modules/zen-observable/lib/Observable.js:240:7) {
type: 'ApolloError',
graphQLErrors: [],
clientErrors: [],
networkError: {
name: 'ServerParseError',
response: { size: 0, timeout: 0 },
statusCode: 405,
bodyText: 'Method Not Allowed'
}
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Command "yarn run build" exited with 1

Related

How to fix [ERROR] Could not resolve "path-browserify" in Astro Build 2.0?

I recently upgraded my Blog made with Astro 1.0 to the new Astro 2.0 using the next command:
npm install astro#latest
But when I try to run my project in development mode with npm run dev I found the next error:
[ERROR] Could not resolve "path-browserify"
node_modules/#astrojs/rss/dist/util.js:1:18:
1 │ import npath from "path-browserify";
╵ ~~~~~~~~~~~~~~~~~
You can mark the path "path-browserify" as external to exclude it from the bundle, which will
remove this error.
/Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:1604
let error = new Error(`${text}${summary}`);
^
Error: Build failed with 1 error:
node_modules/#astrojs/rss/dist/util.js:1:18: ERROR: Could not resolve "path-browserify"
at failureErrorWithLog (/Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:1604:15)
at /Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:1056:28
at runOnEndCallbacks (/Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:1476:61)
at buildResponseToResult (/Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:1054:7)
at /Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:1166:14
at responseCallbacks.<computed> (/Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:701:9)
at handleIncomingPacket (/Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:756:9)
at Socket.readFromStdout (/Users/victoralvarado/Development/My Projects/vicbox-tech/node_modules/esbuild/lib/main.js:677:7)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12) {
errors: [
{
detail: undefined,
id: '',
location: {
column: 18,
file: 'node_modules/#astrojs/rss/dist/util.js',
length: 17,
line: 1,
lineText: 'import npath from "path-browserify";',
namespace: '',
suggestion: ''
},
notes: [
{
location: null,
text: 'You can mark the path "path-browserify" as external to exclude it from the bundle, which will remove this error.'
}
],
pluginName: '',
text: 'Could not resolve "path-browserify"'
}
],
warnings: []
}
I don’t know exactly why and I tried many things to fix that without a positive result.
The last thing that I do was update the npm dependencies with a simple command npm update and the error was going. It was that way how to solve the error.
I ran the npm update command expecting some deprecated library or dependency to update and fix the error.

Why is there always error:0308010C:digital envelope routines::unsupported on laravel 6 using laragon?

When I write the command npm install && npm run dev it always appears like this
Error: error:0308010C:digital envelope routines::unsupported
Error: error:0308010C:digital envelope routines::unsupported
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.8.0
Making my first laravel 6 by using laragon and fron-end vue

Cannot log stack traces with apollo server

I'm building a graphql application with apollo server and I'm having trouble figuring out how to log stack traces serverside in production mode.
I found these docs but it's not clear how to correctly log stack traces in production.
I have the following formatError function:
formatError: ((err) => {
console.error(err.originalError)
return err
})
and when one of my resolvers throws an error with NODE_ENV=production I see the following output:
Error: Unexpected error value: "could not get config value"
at locatedError (/tripvector/node_modules/graphql/error/locatedError.js:24:9)
at /tripvector/node_modules/graphql/execution/execute.js:491:54
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async execute (/tripvector/node_modules/apollo-server-core/dist/requestPipeline.js:204:20)
at async processGraphQLRequest (/tripvector/node_modules/apollo-server-core/dist/requestPipeline.js:138:28)
at async processHTTPRequest (/tripvector/node_modules/apollo-server-core/dist/runHttpQuery.js:187:30)
However, when I run in debug mode, the original error is printed as I expect:
Error: could not get config value
at validate (file:///Users/paymahn/code/tripvector/tripvector-mono/backend/lib/settings/settings.js:11:15)
at getGoogleSecret (file:///Users/paymahn/code/tripvector/tripvector-mono/backend/lib/settings/settings.js:29:12)
at Object.loginWithGoogle (file:///Users/paymahn/code/tripvector/tripvector-mono/backend/api/users/graphql/mutations.js:141:30)
at field.resolve (/Users/paymahn/code/tripvector/tripvector-mono/backend/node_modules/apollo-server-core/dist/utils/schemaInstrumentation.js:52:26)
at executeField (/Users/paymahn/code/tripvector/tripvector-mono/backend/node_modules/graphql/execution/execute.js:469:20)
at /Users/paymahn/code/tripvector/tripvector-mono/backend/node_modules/graphql/execution/execute.js:365:22
at promiseReduce (/Users/paymahn/code/tripvector/tripvector-mono/backend/node_modules/graphql/jsutils/promiseReduce.js:23:9)
at executeFieldsSerially (/Users/paymahn/code/tripvector/tripvector-mono/backend/node_modules/graphql/execution/execute.js:361:43)
at executeOperation (/Users/paymahn/code/tripvector/tripvector-mono/backend/node_modules/graphql/execution/execute.js:335:14)
at execute (/Users/paymahn/code/tripvector/tripvector-mono/backend/node_modules/graphql/execution/execute.js:130:20)
I throw the error with the following code:
function validate(val) {
if (!val) {
throw new Error('could not get config value')
}
return val
}
How can I correctly configure apollo server to print stack traces for errors, even in production?
As usual, I found the answer 2 minutes after asking. I was doing some silly error catching and rethrowing in promises which is why this problem was happening only in production.

Source GraphQL API: HTTP error 400 Bad Request

I've set up an apollo federation architecture accessible via a gateway. I want to access it via gatsby using the official plugin gatsby-source-graphql. I've followed their documentation and attempted to include the plugin with the "simple" example.
When I run yarn build on my gatsby project I get the following termanal output:
success onPreInit - 0.048s
success initialize cache - 0.033s
success copy gatsby files - 0.139s
success Compiling Gatsby Functions - 0.239s
success onPreBootstrap - 0.258s
success createSchemaCustomization - 0.003s
ERROR #11321 PLUGIN
"gatsby-source-graphql" threw an error while running the sourceNodes lifecycle:
Source GraphQL API: HTTP error 400 Bad Request
Error: Source GraphQL API: HTTP error 400 Bad Request
- fetch.js:11 exports.fetchWrapper
[yotee.co]/[gatsby-source-graphql]/fetch.js:11:11
- task_queues:96 processTicksAndRejections
node:internal/process/task_queues:96:5
My gatsby-config.js is this:
module.exports = {
siteMetadata: {
url: "https://www.XXXX.co",
title: "XXXX",
description: "",
},
plugins: [
{
resolve: 'gatsby-source-graphql',
options: {
typeName: 'Gateway',
fieldName: 'gateway',
url: 'https://XXXXXX'
}
},
"gatsby-plugin-styled-components",
"gatsby-plugin-gatsby-cloud",
"#chakra-ui/gatsby-plugin",
"gatsby-plugin-react-helmet"
],
};
The error "Source GraphQL API: HTTP error 400 Bad Request" is extremely vague, and I'm unable to get a more verbose message error.
What can I do to better understand this error and solve it?
The gatsby plugin will attempt to retreive the schema from your apollo-server. Ensure that introspection is enabled in production so this step does not fail.
{"extensions":{"code":"GRAPHQL_VALIDATION_FAILED"},"level":"warn","locations":[{"column":3,"line":2}],"message":"GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production"}
By:
const server = new ApolloServer({
// other properties
introspection: true
});

Near Protocol FunctionCallError(MethodResolveError(MethodNotFound))

I'm new in blockchain, smart contract and near protocol. I'm trying to learn from https://near.academy/ . There's a sample contract on testnet : museum.testnet.
I'm using windows and i installed wsl2.
I can login with
near login command. But after that, when i called near view museum.testnet getmemecount command its giving me error below. Can anyone help me on this?
View call: museum.testnet.getmemecount()
An error occured
Error: Querying [object Object] failed: wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound)).
{
"block_hash": "SZv8UsCeNXLkhjPa9KeZY6xJXmKNb6MLyKXqHVddiT5",
"block_height": 65109663,
"error": "wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound))",
"logs": []
}
at JsonRpcProvider.query (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:116:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Account.viewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:351:24)
at async exports.callViewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/index.js:75:48)
at async Object.handler (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/utils/exit-on-error.js:52:9)
TypedError: Querying [object Object] failed: wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound)).
{
"block_hash": "SZv8UsCeNXLkhjPa9KeZY6xJXmKNb6MLyKXqHVddiT5",
"block_height": 65109663,
"error": "wasm execution failed with error: FunctionCallError(MethodResolveError(MethodNotFound))",
"logs": []
}
at JsonRpcProvider.query (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/providers/json-rpc-provider.js:116:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Account.viewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/node_modules/near-api-js/lib/account.js:351:24)
at async exports.callViewFunction (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/index.js:75:48)
at async Object.handler (/home/cinar/.nvm/versions/node/v14.18.0/lib/node_modules/near-cli/utils/exit-on-error.js:52:9) {
type: 'UntypedError',
context: undefined
}
The method name is get_meme_count, not getmemecount. See the source code of the museum here.
$ near view museum.testnet get_meme_count
View call: museum.testnet.get_meme_count()
67
Does some part of near academy mention it as getmemecount?

Resources