Magento 2 PWA invalid json response body at http://localhost/graphql reason: Unexpected token < in JSON at position error occur while setup PWA studio - magento

I got the below error while setup PWA with Magento 2 when I run the yarn build command.
Magento version: 2.4.4
PWA Version: ^0.4.0
PHP version: 8.1
Node Js Version: v16.19.0
Yarn Version: 1.22.19
FetchError: invalid json response body at http://localhost/projectname/graphql reason: Unexpected token < in JSON at position 0
at \projectname\pwa-studio\packages\pwa-buildpack\node_modules\node-fetch\lib\index.js:272:32
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async module.exports (\projectname\pwa-studio\packages\venia-concept\webpack.config.js:61:22) {
type: 'invalid-json'
}

Related

Cypress 10 throws error readying js config file: SyntaxError: /frontend/cypress.config.js: Unexpected token c in JSON at position 0

I'm trying to update transition our CI e2e runs to run Cypress 10.x. It runs on a Docker container via BuildKite and it's currently loading 10.11.0. It was previously complaining that it couldn't find the config file (using js format cypress.config.js). I pointed the cypress run CLI to the file using --config-file param and now the file is being found but I'm getting an error that seems to be expecting the old json config file format
SyntaxError: /frontend/cypress.config.js: Unexpected token c in JSON at position 0
Cypress versions on the container show as:
Cypress package version: 10.11.0
Cypress binary version: 10.11.0
Electron version: 21.0.0
Bundled Node version: 16.16.0
I don't see a config file format flag in the cypress run CLI documentation but it seems like Cypress 10 should not be having this issue. Don't see this exact issue when I search github/SO/google. Any thoughts?

Can't play an remote audio file from an API made with Laravel from a React Native Expo app

I am trying to play an audio file with Expo Audio from an API made with Laravel in a React Native app but it's returning 404 not found
this is the Laravel API code that returns the URL to the file on the server
$audio_url = 'https://website.com/api' . Storage::url($filename);
and laravel returned a URL like this
https://website.com/api/storage/filename.mp3
and this is the Audio player code in React Native Expo
sound.current = await Audio.Sound.createAsync(
{uri: audioDetails.url},
{ shouldPlay: true }
);
but I am getting this error
[Unhandled promise rejection: Error: com.google.android.exoplayer2.upstream.v$a: com.google.android.exoplayer2.upstream.v$a: java.io.FileNotFoundException: : open failed: ENOENT (No such file or directory)]
please what can I do, thanks in Advance

Apollo CLIError: Error in "Loading schema for Unnamed Project"

I am trying to get api-types for the project that is running Apollo server since years. But now when I run command apollo client:codegen api-types --includes=src/**/*.tsx --endpoint=http://localhost:4000/graphql --target=typescript --globalTypesFile=src/api-types/globalTypes.ts I get below error:
Warning: apollo update available from 2.33.4 to 2.33.9.
⠸ Loading Apollo Project
Generating query files
CLIError: Error in "Loading schema for Unnamed Project": Error: ServerError: Response not successful: Received status code 500
at Object.error (/workApp/node_modules/#oclif/errors/lib/index.js:26:15)
at Generate.error (/workApp/node_modules/#oclif/command/lib/command.js:60:23)
at OclifLoadingHandler.showError (/workApp/node_modules/apollo/lib/OclifLoadingHandler.js:29:22)
at OclifLoadingHandler.handle (/workApp/node_modules/apollo/lib/OclifLoadingHandler.js:14:18)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
oclif: { exit: 2 },
✖ Loading Apollo Project
→ Error initializing Apollo GraphQL project "Unnamed Project": Error:
…
Generating query files
› Error: Error initializing Apollo GraphQL project "Unnamed Project":
› Error: Error in "Loading schema for Unnamed Project": Error:
› ServerError: Response not successful: Received status code 500
I looked a few Stackoveflow posts and tried this command too: apollo schema:download --endpoint=http://localhost:4000/graphql schema.json
But that also gives me below error:
✔ Loading Apollo Project
✖ Saving schema to schema.json
→ ServerError: Response not successful: Received status code 500
Error: ServerError: Response not successful: Received status code
500
Any suggestion to fix this error?
Along with your endpoint url ,if needed pass Authorization token in the header options .

Not able to run prisma deploy: Error: Cluster undefined does not exist

I am learning graphql and following this tutorial https://www.howtographql.com/react-apollo/1-getting-started/
i have installed prisma using npm install -g prisma and while running this command prisma deploy in server folder iam getting this error:
config CWD /Users/aravind/tekie/hackernews-react-apollo/server +0ms
config HOME /Users/aravind +2ms
config definitionDir /Users/aravind/tekie/hackernews-react-apollo/server/database +5ms
config definitionPath /Users/aravind/tekie/hackernews-react-apollo/server/database/prisma.yml +0ms
cli { isGlobal: true } +0ms
StatusChecker setting status checker +0ms
cli command id deploy +7ms
cli:plugincache Got plugin from cache +0ms
cli:plugincache /Users/aravind/Library/Caches/prisma/plugins.json +1ms
cli:plugincache Got plugin from cache +1ms
cli:plugincache /Users/aravind/Library/Caches/prisma/plugins.json +0ms
plugins findCommand prisma-cli-core +0ms
plugin requiring command +0ms
cli-engine:plugins:manager requiring /usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core +0ms
portfinder:defaultHosts exports._defaultHosts is: [ '0.0.0.0', '127.0.0.1', '::1', 'fe80::1', 'fe80::18fb:a4af:2b44:3fea', '192.168.43.100', '2405:204:6209:18b0:144f:bac3:86ac:3cdf', '2405:204:6209:18b0:fd46:e3b7:952f:d569', 'fe80::1c49:3cff:fe5f:7e16', 'fe80::3e5f:ab5d:16dd:a8bf' ] +0ms
cli-engine:plugins:manager required +538ms
plugin required command +540ms
StatusChecker setting status checker +569ms
Error: Cluster undefined does not exist.
at Deploy.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/src/commands/deploy/index.ts:175:13)
at step (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/index.js:42:23)
at Object.next (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/index.js:23:53)
at fulfilled (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/index.js:14:58)
at <anonymous>
util timed out +0ms
Exiting with code: 0
up to this all the set-up was correct and I am unable to run this command. Any help is appreciated.
I also witnessed the same problem that you identified while trying to deploy the service, following the same tutorial.
I stumbled upon the "solution" from the tutorial writer itself, in this GitHub issue:
The current version of the tutorial just works with Prisma CLI
versions < 1.7, so be sure you have some 1.6.x version installed. You
can check your current prisma version with this command:
prisma version
Then uninstall and install the correct version like this:
npm uninstall -g prisma
npm install -g prisma#1.6.3
Can you run with yarn prisma deploy after download yarn not using npm prisma deploy

Error when running `feathers generate authentication` for `RethinkDB`

I’m having issues when running feathers generate authentication with selecting rethinkdb as database.
Environment:
Mac OS X Sierra
feathers 2.2.3
npm 5.1.0
rethinkdb 2.3.5
Steps to reproduce:
I have up and running https://github.com/tenzan/feathers-chat.git
feathers generate authentication
Select Username + Password (Local)
What is the name of the user (entity) service? (users) <-- Enter
What kind of service is it? (Use arrow keys) ❯ RethinkDB <-- Enter
Output:
events.js:182
throw er; // Unhandled 'error' event
^
TypeError: Parameter "url" must be a string, not object
at Url.parse (url.js:102:11)
at Object.urlParse [as parse] (url.js:96:5)
at ConnectionGenerator._getConfiguration (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:46:24)
at ConnectionGenerator._writeConfiguration (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:103:32)
at ConnectionGenerator.writing (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:297:10)
at Object.<anonymous> (/usr/local/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:417:23)
at /usr/local/lib/node_modules/feathers-cli/node_modules/run-async/index.js:25:25
at Promise (<anonymous>)
at /usr/local/lib/node_modules/feathers-cli/node_modules/run-async/index.js:24:19
at /usr/local/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:418:9
I had same errors on different Mac PCs with same environment.
It's an issue with generator-feathers
Remove the rethinkdb object from config/default
will see if I can fix the main problem
Edit: Fixed

Resources