gatsby-source-contentful options error on build - deployment

some time back I made a site with Gatsby and I've used static markdown for my pages.
Now I wanted to move all my posts on Contentful and everything works fine in development.
When I went on Netlify to deploy my website it threw me an error.
I've looked for solutions but haven't found one yet.
I tried to run the build locally and it throws me this error, so I believe I need to fix this first before deploying.
ERROR
Problems with gatsby-source-contentful plugin options:
spaceId: undefined - "spaceId" is required
accessToken: undefined - "accessToken" is required
host (default value): "cdn.contentful.com"
environment (default value): "master"
downloadLocal (default value): false
localeFilter (default value): [Function]
forceFullSync (default value): false
pageLimit (default value): 100
useNameForId (default value): true
not finished onPreBootstrap - 0.056s
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-hello-world#0.1.0 build: `gatsby build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gatsby-starter-hello-world#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2020-05-13T15_20_35_160Z-debug.log
Apparently it does not read the .env variables. I do have the variables set on Netlify and as I said earlier on development it works just fine without throwing any kind of error.
I did not have 'dotenv' installed before and tried to install it but did not solve the issue.
I do have only one '.env' file, but have tried to make '.env.development' and '.env.production' files but did not work.
How can I fix the problem?
As an extra I do get some errors, on Netlify only, such as
error There was an error in your GraphQL query:
Unknown type "ContentfulFluid".
but I do not think they cause the build to fail.
EDIT:
I should add that if I do write the .env variables as strings the build does run locally, which makes me believe it would do on deployment.

You have to set your .env variables in Netlify with GATSBY_ prefix. So, your CONTENTFUL_ID variable will be GATSBY_CONTENTFUL_ID.
It's recommended to use the same naming in your local and build environment to keep the logic between them. So, you will need to prefix all references to .env using GATSBY_ in your local environment too. To do this, you may need to create a .env.development and .env.production if you haven't set it before.
You can check for further information in Netlify documentation:
Gatsby environment variables
Any environment variables prefixed with GATSBY_ will be processed by
Gatsby and made available in the browser for client-side JavaScript
access. Visit the Gatsby docs about environment variables for more
information.
As well as in Gatsby's documentation.

After many attempts trying to debug my code and installing previous versions of gatsby-source-contentful I found out that you would get an error if you have no Media on contentful.
To fix any similar error all you need to do is add a dummy media on contentful itself and it would work just fine.

In the environment variable .env.development you need to add
CONTENTFUL_SPACE_ID = <Paste here your space Id>
CONTENTFUL_ACCESS_TOKEN = <Paste here your delivery API - access token>

Related

I was trying to install react-query. But it is not installed. How to solve it

Heading
yarn add v1.22.18
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies
caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/#tanstack%2freact-query: Not found".
info If you think this is a bug, please open a bug report with
the information provided in "G:\Projects\74\doctors-portal-client\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
As suggested by the error message, you can try to delete your package-lock.json file to get rid of the warning. As stated in the npm documentation, package-lock.json is automatically generated by npm for any operation that modifies the node_modules tree or package.json, so don't worry about breaking anything by removing this file, as it will be generated the next time you make some changes to your project.

Pytest Github Action failed in Django REST API project

I have updated my workflow action from simple super-linter to PYTEST. I get the following error in github
Run pipenv install --deploy --dev
ERROR: Pipfile not found! Aborting! Please ensure that the file exists and is located in your project root directory.
Error: Process completed with exit code 1.
Super linter is really lazy and fails unnecessarily even if the code is correctly formatted?
I have not added any file in my project? Do I need to?

Protractor Process exited with error code 100

I'm trying to setup protractor on different computer. It is using the same files with my other computer (cannot be used because hdisc corrupted).
It run fine on my other computer but I am getting error "Process exited with error code 100" when I tried to run protractor on this one.
I've tried to delete the node modules, clean cache and perform npm install again to install the dependencies. It helps my earlier issue (cannot run webdriver) but is now causing me this one.
[14:44:09] I/launcher - Running 1 instances of WebDriver
[14:44:09] I/local - Starting selenium standalone server...
[14:44:11] E/launcher - Error: Error: Server terminated early with status 1
at earlyTermination.catch.e (C:\Users\PMO\Documents\DG\Jasmine\node_modules\selenium-webdriver\remote\index.js:252:52)
at process._tickCallback (internal/process/next_tick.js:68:7)
[14:44:11] E/launcher - Process exited with error code 100
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! ProtractorTutorial# protractor: `protractor conf.js`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the protractor# protractor script.
My current chrome version is: 74.0.3729.131
Webdriver version: chromedriver_74.0.3729.6.exe
OS: Windows 10.
Please advise me on how to fix this issue. Or is there any specific version of chrome and webdriver that can work?
use directConnect=true in your config. if you are already using that, The problem is with the webdriver.
Try running below commands from your project location
webdriver-manager clean
node node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0
I encountered a similar issue yesterday and inspired by Madhan's solution I worked it out.
I'm learning angularJS thru the official tutorial. I found protractor is actually a standalone tool (I'm a newbie in front-end development), which means it can be run separately.
So following the official setup guide, I run
protractor e2e-tests/protractor.conf.js
and found below feedback:
E/launcher - SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 77
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'xxx', ip: 'xxx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '11.0.2'
Driver info: driver.version: unknown
remote stacktrace: 0 chromedriver_77.0.3865.40 0x00000001078b7f09 chromedriver_77.0.3865.40 + 3694345
And my chrome version was 76 in the moment.
So after I upgraded chrome to 77, it worked.
Tips:
if use directConnect=true in your config still doesn't work, try to run in standalone mode, which can provide you more useful feedback.
For me, the issue was a space after Scenario in the feature file
Wrong Scenario :
Corrected to Scenario: and the feature started executing
Cant see this answer above, so this might help someone
Your problem might be that you need to run your tests without sudo!
Sometimes if you get an EACCESS error, you can then change directory permissions so that you can run it without sudo.
My issue here was an outdated version of webdriver-manager. This fix only partially fixes the issue because it does not update the npm package. To completely fix this you need to ensure your package.json is configured with the correct webdriver-manager version (npm install webdriver-manager#latest --save-dev). Then you'll need to run:
npm install
node ./node_modules/protractor/bin/webdriver-manager clean
node ./node_modules/protractor/bin/webdriver-manager update
You may also need to run a npm dedupe to ensure all items are using the new package
In my case I had to run update + start
node node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0
node node_modules/protractor/bin/webdriver-manager start --standalone --versions.standalone=3.8.0
thank you 🤘🏻
For me it was a missing tsconfig.json file in my e2e folder. If you don't have one in your e2e folder, simply create one and put this code into it. Then run ng e2e again.
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
I'm using:
Angular CLI: 9.0.7
Node: 14.16.0
Chrome: 89.0.4389.82
chromedriver_89.0.4389.23

IBM Cloud Node-RED Manage Palette doesn't install items

I'm on IBM Cloud trying to install node-red-node-smooth from the manage palette, and I'm getting an error. I've tried several other packages as well. The error that I get in my debug log shows:
npm WARN saveError ENOENT: no such file or directory, open '/home/vcap/app/.node-red/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/vcap/app/.node-red/package.json'
npm WARN .node-red No description
npm WARN .node-red No repository field.
npm WARN .node-red No README data
npm WARN .node-red No license field.
+ node-red-node-smooth#0.1.0
updated 1 package in 4.726s
npm ERR! Object.entries is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vcap/app/.npm/_logs/2018-05-10T15_01_53_296Z-debug.log
The log file has a stack trace that starts with this:
106 verbose stack TypeError: Object.entries is not a function
Is there something obvious that I'm doing wrong?
instances deployed in the last few days got npm 6.0.0. This version of npm contained a bug that caused the Object.entries is not a function error.
npm released 6.0.1 that fixed this issue today (Thursday May 10th 2018)
You have three possible ways to fix your instance:
deploy a new instance and copy your flows over
or, set the NPM_CONFIG_AUDIT environment variable* to false - which stops npm 6.0.0 going down the code path containing the bug.
or, set the NODE_MODULE_CACHE environment variable* to false and trigger a restage of your application - that will get npm 6.0.1 installed.
If you don't have much in the way of flows at this point, deleting and creating a new instance is the easiest option.
If you want to 'repair' your existing instance, option 2 is probably the easiest as it just requires an automatic restart of the app, rather than a restage which requires the cf command-line tool to trigger manually.
To set an environment variable within your IBM Cloud application, go to your application's dashboard page. Go to the Runtime section in the left-hand navigation. Select 'Environment Variables' in the tabs across the top and scroll down to the 'User defined' section of the page. Click 'Add' - enter the env var details and click 'Save'. Your app will be restarted with the variable set.

Gulp watch shows a lot of eslint errors. Which dependencies are missing?

I made a git clone app Ionic 1 made with Generator-M-Ionic
I've done the following steps to install the dependencies:
npm install
bower install
npm install --global gulp-cli
And the prerequisites of the generator itself:
npm i -g yo gulp bower
npm i -g generator-m-ionic
After that the command
gulp watch
The terminal performs normal
[13:58:09] Starting 'jsonlint'...
[13:58:10] Finished 'watch' after 191 ms
[Browsersync] Access URLs:
----------------------------------------
Local: http://localhost:3000
External: http://192.168.100.235:3000
----------------------------------------
UI: http://localhost:3001
UI External: http://192.168.100.235:3001
----------------------------------------
[Browsersync] Serving files from: app
[Browsersync] Serving files from: .tmp
[13:58:10] Finished 'jsonlint' after 488 ms
But several errors like this below appear later in the terminal and my browser only opens an empty screen.
app/main/controllers/logoutCtrl.js
2:1 error "SocialWaveApp" is not defined no-undef
3:3 warning Unexpected console statement no-console
4:3 error "mixpanel" is not defined no-undef
8:9 error "hideSheet" is defined but never used no-unused-vars
13:32 error "index" is defined but never used no-unused-vars
17:9 error "mixpanel" is not defined no-undef
22:9 warning Unexpected console statement no-console
30:11 error "facebookConnectPlugin" is not defined no-undef
34:13 warning Unexpected console statement no-console
How to find out what are the dependencies and what is missing?
The problem was with some dependencies like fserve which only runs on Mac, so the solution was move to a macbook, now the app work.
The eslint errors only show that my project is not using the JS guide lines.