Giter Club home page Giter Club logo

starter-gatsby-blog's Introduction

Contentful Gatsby Starter Blog

Create a Gatsby blog powered by Contentful.

An article page of the starter blog

Static sites are scalable, secure and have very little required maintenance. They come with a drawback though. Not everybody feels good editing files, building a project and uploading it somewhere. This is where Contentful comes into play.

With Contentful and Gatsby you can connect your favorite static site generator with an API that provides an easy to use interface for people writing content and automate the publishing using services like Travis CI or Netlify.

Features

Getting started

See our official Contentful getting started guide.

Get the source code and install dependencies.

$ git clone https://github.com/contentful/starter-gatsby-blog.git
$ npm install

Or use Gatsby Cloud

Use Deploy Now to get started in Gatsby Cloud:

Deploy to Gatsby Cloud

If you use Deploy Now, Gatsby Cloud will run the gatsby-provision script on your behalf, if you choose, after you Quick Connected to your empty Contentful Space. That script will add the necessary content models and content to support this site.

Or use the Gatsby CLI.

$ gatsby new contentful-starter-blog https://github.com/contentful/starter-gatsby-blog/

Set up of the needed content model and create a configuration file

This project comes with a Contentful setup command npm run setup.

This command will ask you for a space ID, and access tokens for the Contentful Management and Delivery API and then import the needed content model into the space you define and write a config file (./.contentful.json).

npm run setup automates that for you but if you want to do it yourself rename .contentful.json.sample to .contentful.json and add your configuration in this file.

Crucial Commands

npm run dev

Run the project locally with live reload in development mode.

npm run build

Run a production build into ./public. The result is ready to be put on any static hosting you prefer.

npm run serve

Spin up a production-ready server with your blog. Don't forget to build your page beforehand.

Deployment

See the official Contentful getting started guide.

Contribution

Feel free to open pull requests to fix bugs. If you want to add features, please have a look at the original version. It is always open to contributions and pull requests.

You can learn more about how Contentful userland is organized by visiting our about repository.

starter-gatsby-blog's People

Contributors

aghreed avatar alvinometric avatar arpl avatar axe312ger avatar bloomca avatar bradwjs avatar brittanyrw avatar bulentyusuf avatar cf-allstar[bot] avatar davidfateh avatar denkristoffer avatar dependabot-preview[bot] avatar dependabot[bot] avatar dominiksipowicz avatar dschau avatar fk avatar graysonhicks avatar gregferg avatar jo-sm avatar khaledgarbaya avatar loudmouth avatar massao avatar matthew-contentful avatar shy avatar sophiemcgarity avatar stefanjudis avatar thinkybeast avatar tylerbarnes avatar zeusdeux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starter-gatsby-blog's Issues

Possibility of gatsby-image traced SVG with WebP?

Gatsby-transformer-sharp allows you to have a query of GatsbyImageSharpFluid_withWebp_tracedSVG - essentially allowing the performance of WebP with the lazy loading traced SVG. Right now, Contentful only allows for GatsbyContentfulFluid_tracedSVG or GatsbyContentfulFluid_withWebp - so you end up having to go in one direction or the other. Is it possible that we'd be able to have the option for both, much like the gatsby-transformer-sharp plugin allows?

adding defer: true in gatsby-node.js (DSG) throws Built Rendering Engines failed error

i'm trying to enable DSG option by adding defer: true but i'm getting Built Rendering Engines failed error, the build works fine when i set defer: false, below is the gatsby-node.js code

createPage({
        path: `/blog/${post.slug}/`,
        component: blogPost,
        context: {
          slug: post.slug,
          previousPostSlug,
          nextPostSlug,
        },
        defer: true
 })

below is the exact error message i'm getting

failed Validating Rendering Engines - 2.750s
 ERROR #98001  ENGINE.VALIDATION
Built Rendering Engines failed validation failed validation.
Please open an issue with a reproduction at https://gatsby.dev/new-issue for more help.
  Error: Worker exited before finishing task
  - index.js:205 ChildProcess.<anonymous>
    [contentful-starter-blog]/[gatsby-worker]/dist/index.js:205:41

here is my gatsby info

System:
OS: macOS
Binaries:
Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
Browsers:
Chrome: 105.0.5195.102
Safari: 16.0
npmPackages:
gatsby: ^5.5.0 => 5.5.0
gatsby-plugin-image: ^3.5.0 => 3.5.0
gatsby-plugin-react-helmet: ^6.5.0 => 6.5.0
gatsby-plugin-sharp: ^5.5.0 => 5.5.0
gatsby-provision-contentful: ^0.0.5 => 0.0.5
gatsby-source-contentful: ^8.5.0 => 8.5.0
gatsby-transformer-sharp: ^5.5.0 => 5.5.0
npmGlobalPackages:
gatsby-cli: 5.5.0

cannot deploy starter app on heroku

I am walking through the Gatsby starter to deploy on Heroku. After following all of the setup steps, I received the output below from Heroku when I ran git push heroku master.

I tried installing nan separately in case it was a version issue, but didn't have any luck there.

Enumerating objects: 305, done.
Counting objects: 100% (305/305), done.
Delta compression using up to 8 threads
Compressing objects: 100% (158/158), done.
Writing objects: 100% (305/305), 652.79 KiB | 217.60 MiB/s, done.
Total 305 (delta 140), reused 305 (delta 140)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.13.1...
remote:        Using default npm version: 6.12.1
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (package.json + package-lock)
remote:        
remote:        > [email protected] install /tmp/build_37fd982bcb136d9ca481ab7e0b36cf53/node_modules/sharp
remote:        > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
remote:        
remote:        info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz
remote:        make: Entering directory '/tmp/build_37fd982bcb136d9ca481ab7e0b36cf53/node_modules/sharp/build'
remote:          TOUCH Release/obj.target/libvips-cpp.stamp
remote:          CXX(target) Release/obj.target/sharp/src/common.o
remote:        In file included from ../../nan/nan_converters.h:67:0,
remote:                         from ../../nan/nan.h:202,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ToFactoryBase<v8::Boolean>::return_t Nan::imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value>)’:
remote:        ../../nan/nan_converters_43_inl.h:18:51: warning: ‘v8::MaybeLocal<v8::Boolean> v8::Value::ToBoolean(v8::Local<v8::Context>) const’ is deprecated: ToBoolean can never throw. Use Local version. [-Wdeprecated-declarations]
remote:               val->To ## TYPE(isolate->GetCurrentContext())                            \
remote:                                                           ^
remote:        ../../nan/nan_converters_43_inl.h:22:1: note: in expansion of macro ‘X’
remote:         X(Boolean)
remote:         ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2568:59: note: declared here
remote:                         V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
remote:                                                                   ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../../nan/nan_converters.h:67:0,
remote:                         from ../../nan/nan.h:202,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ValueFactoryBase<bool>::return_t Nan::imp::ToFactory<bool>::convert(v8::Local<v8::Value>)’:
remote:        ../../nan/nan_converters_43_inl.h:37:57: warning: ‘v8::Maybe<bool> v8::Value::BooleanValue(v8::Local<v8::Context>) const’ is deprecated: BooleanValue can never throw. Use Isolate version. [-Wdeprecated-declarations]
remote:           return val->NAME ## Value(isolate->GetCurrentContext());                     \
remote:                                                                 ^
remote:        ../../nan/nan_converters_43_inl.h:40:1: note: in expansion of macro ‘X’
remote:         X(bool, Boolean)
remote:         ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2606:51: note: declared here
remote:                         V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
remote:                                                           ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../../nan/nan_new.h:189:0,
remote:                         from ../../nan/nan.h:203,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::Function>::return_t Nan::imp::Factory<v8::Function>::New(Nan::FunctionCallback, v8::Local<v8::Value>)’:
remote:        ../../nan/nan_implementation_12_inl.h:105:32: error: no matching function for call to ‘v8::Function::New(v8::Isolate*&, void (&)(const v8::FunctionCallbackInfo<v8::Value>&), v8::Local<v8::Object>&)’
remote:                                   , obj));
remote:                                        ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/node.h:63:0,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:4170:31: note: candidate: static v8::MaybeLocal<v8::Function> v8::Function::New(v8::Local<v8::Context>, v8::FunctionCallback, v8::Local<v8::Value>, int, v8::ConstructorBehavior, v8::SideEffectType)
remote:           static MaybeLocal<Function> New(
remote:                                       ^~~
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:4170:31: note:   no known conversion for argument 1 from ‘v8::Isolate*’ to ‘v8::Local<v8::Context>’
remote:        In file included from ../../nan/nan_new.h:189:0,
remote:                         from ../../nan/nan.h:203,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’
remote:        ../../nan/nan_implementation_12_inl.h:337:37: error: no matching function for call to ‘v8::StringObject::New(v8::Local<v8::String>&)’
remote:           return v8::StringObject::New(value).As<v8::StringObject>();
remote:                                             ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/node.h:63:0,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:5426:23: note: candidate: static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)
remote:           static Local<Value> New(Isolate* isolate, Local<String> value);
remote:                               ^~~
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:5426:23: note:   candidate expects 2 arguments, 1 provided
remote:        In file included from ../../nan/nan_new.h:189:0,
remote:                         from ../../nan/nan.h:203,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_implementation_12_inl.h:337:58: error: expected primary-expression before ‘>’ token
remote:           return v8::StringObject::New(value).As<v8::StringObject>();
remote:                                                                  ^
remote:        ../../nan/nan_implementation_12_inl.h:337:60: error: expected primary-expression before ‘)’ token
remote:           return v8::StringObject::New(value).As<v8::StringObject>();
remote:                                                                    ^
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h: In constructor ‘Nan::Utf8String::Utf8String(v8::Local<v8::Value>)’:
remote:        ../../nan/nan.h:1034:53: error: no matching function for call to ‘v8::Value::ToString()’
remote:               v8::Local<v8::String> string = from->ToString();
remote:                                                             ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/node.h:63:0,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2572:44: note: candidate: v8::MaybeLocal<v8::String> v8::Value::ToString(v8::Local<v8::Context>) const
remote:           V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
remote:                                                    ^~~~~~~~
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2572:44: note:   candidate expects 1 argument, 0 provided
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2588:31: note: candidate: v8::Local<v8::String> v8::Value::ToString(v8::Isolate*) const
remote:                         Local<String> ToString(Isolate* isolate) const);
remote:                                       ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2588:31: note:   candidate expects 1 argument, 0 provided
remote:                         Local<String> ToString(Isolate* isolate) const);
remote:                                       ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h:1044:74: error: no matching function for call to ‘v8::String::WriteUtf8(char*&, int, int, const int&)’
remote:                 length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
remote:                                                                                  ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/node.h:63:0,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2782:7: note: candidate: int v8::String::WriteUtf8(v8::Isolate*, char*, int, int*, int) const
remote:           int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
remote:               ^~~~~~~~~
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:2782:7: note:   no known conversion for argument 1 from ‘char*’ to ‘v8::Isolate*’
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h: In member function ‘void Nan::AsyncWorker::SaveToPersistent(const char*, const v8::Local<v8::Value>&)’:
remote:        ../../nan/nan.h:1818:64: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:             New(persistentHandle)->Set(New(key).ToLocalChecked(), value);
remote:                                                                        ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:3403:22: note: declared here
remote:                         bool Set(Local<Value> key, Local<Value> value));
remote:                              ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h: In member function ‘void Nan::AsyncWorker::SaveToPersistent(const v8::Local<v8::String>&, const v8::Local<v8::Value>&)’:
remote:        ../../nan/nan.h:1824:42: warning: ‘bool v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:             New(persistentHandle)->Set(key, value);
remote:                                                  ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:3403:22: note: declared here
remote:                         bool Set(Local<Value> key, Local<Value> value));
remote:                              ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h: In member function ‘void Nan::AsyncWorker::SaveToPersistent(uint32_t, const v8::Local<v8::Value>&)’:
remote:        ../../nan/nan.h:1830:44: warning: ‘bool v8::Object::Set(uint32_t, v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:             New(persistentHandle)->Set(index, value);
remote:                                                    ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:3412:22: note: declared here
remote:                         bool Set(uint32_t index, Local<Value> value));
remote:                              ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h: In member function ‘v8::Local<v8::Value> Nan::AsyncWorker::GetFromPersistent(const char*) const’:
remote:        ../../nan/nan.h:1836:61: warning: ‘v8::Local<v8::Value> v8::Object::Get(v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:                 New(persistentHandle)->Get(New(key).ToLocalChecked()));
remote:                                                                     ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:3457:51: note: declared here
remote:           V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
remote:                                                           ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h: In member function ‘v8::Local<v8::Value> Nan::AsyncWorker::GetFromPersistent(const v8::Local<v8::String>&) const’:
remote:        ../../nan/nan.h:1842:55: warning: ‘v8::Local<v8::Value> v8::Object::Get(v8::Local<v8::Value>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:             return scope.Escape(New(persistentHandle)->Get(key));
remote:                                                               ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:3457:51: note: declared here
remote:           V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
remote:                                                           ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from ../src/common.cc:24:0:
remote:        ../../nan/nan.h: In member function ‘v8::Local<v8::Value> Nan::AsyncWorker::GetFromPersistent(uint32_t) const’:
remote:        ../../nan/nan.h:1847:57: warning: ‘v8::Local<v8::Value> v8::Object::Get(uint32_t)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:             return scope.Escape(New(persistentHandle)->Get(index));
remote:                                                                 ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:3461:51: note: declared here
remote:           V8_DEPRECATED("Use maybe version", Local<Value> Get(uint32_t index));
remote:                                                           ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from /usr/include/c++/7/cassert:44:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node_object_wrap.h:26,
remote:                         from ../../nan/nan.h:53,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’:
remote:        ../../nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
remote:             assert(persistent().IsNearDeath());
remote:                                 ^
remote:        In file included from ../../nan/nan.h:2657:0,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_object_wrap.h: In member function ‘void Nan::ObjectWrap::MakeWeak()’:
remote:        ../../nan/nan_object_wrap.h:67:34: warning: ‘void v8::PersistentBase<T>::MarkIndependent() [with T = v8::Object]’ is deprecated: Weak objects are always considered independent. Use TracedGlobal when trying to use EmbedderHeapTracer. Use a strong handle when trying to keep an object alive. [-Wdeprecated-declarations]
remote:             persistent().MarkIndependent();
remote:                                          ^
remote:        In file included from /app/.cache/node-gyp/12.13.1/include/node/v8-internal.h:14:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/v8.h:25,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node.h:63,
remote:                         from ../src/common.cc:22:
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8.h:567:22: note: declared here
remote:               V8_INLINE void MarkIndependent());
remote:                              ^
remote:        /app/.cache/node-gyp/12.13.1/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
remote:           declarator __attribute__((deprecated(message)))
remote:           ^~~~~~~~~~
remote:        In file included from /usr/include/c++/7/cassert:44:0,
remote:                         from /app/.cache/node-gyp/12.13.1/include/node/node_object_wrap.h:26,
remote:                         from ../../nan/nan.h:53,
remote:                         from ../src/common.cc:24:
remote:        ../../nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’:
remote:        ../../nan/nan_object_wrap.h:124:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
remote:             assert(wrap->handle_.IsNearDeath());
remote:                                  ^
remote:        In file included from ../src/common.cc:27:0:
remote:        ../src/common.h: At global scope:
remote:        ../src/common.h:82:20: error: ‘Handle’ is not a member of ‘v8’
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
remote:                            ^~~~~~
remote:        ../src/common.h:82:37: error: expected primary-expression before ‘>’ token
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                             ^
remote:        ../src/common.h:82:39: error: ‘obj’ was not declared in this scope
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                               ^~~
remote:        ../src/common.h:82:56: error: expected primary-expression before ‘attr’
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                                                ^~~~
remote:        ../src/common.h:82:60: error: expression list treated as compound expression in initializer [-fpermissive]
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                                                    ^
remote:        ../src/common.h:83:29: error: ‘Handle’ is not a member of ‘v8’
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                     ^~~~~~
remote:        ../src/common.h:83:46: error: expected primary-expression before ‘>’ token
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                                      ^
remote:        ../src/common.h:83:48: error: ‘obj’ was not declared in this scope
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                                        ^~~
remote:        ../src/common.h:83:65: error: expected primary-expression before ‘attr’
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
remote:                                                                         ^~~~
remote:        ../src/common.h:84:48: error: ‘Handle’ is not a member of ‘v8’
remote:           template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                        ^~~~~~
remote:        ../src/common.h:84:65: error: expected primary-expression before ‘>’ token
remote:           template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                         ^
remote:        ../src/common.h:84:67: error: ‘obj’ was not declared in this scope
remote:           template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                           ^~~
remote:        ../src/common.h:84:84: error: expected primary-expression before ‘attr’
remote:           template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                                            ^~~~
remote:        ../src/common.h:84:37: warning: variable templates only available with -std=c++14 or -std=gnu++14
remote:           template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                             ^~~~~~
remote:        ../src/common.h:84:90: error: expected ‘;’ before ‘{’ token
remote:           template<typename T> v8::Local<T> AttrAs(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                                                  ^
remote:        ../src/common.h:87:37: error: ‘Handle’ is not a member of ‘v8’
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                             ^~~~~~
remote:        ../src/common.h:87:54: error: expected primary-expression before ‘>’ token
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                              ^
remote:        ../src/common.h:87:56: error: ‘obj’ was not declared in this scope
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                ^~~
remote:        ../src/common.h:87:73: error: expected primary-expression before ‘attr’
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                                 ^~~~
remote:        ../src/common.h:87:26: warning: variable templates only available with -std=c++14 or -std=gnu++14
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                  ^~~~~~
remote:        ../src/common.h:87:79: error: expected ‘;’ before ‘{’ token
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                                       ^
remote:        ../src/common.h:90:37: error: ‘Handle’ is not a member of ‘v8’
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
remote:                                             ^~~~~~
remote:        ../src/common.h:90:54: error: expected primary-expression before ‘>’ token
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
remote:                                                              ^
remote:        ../src/common.h:90:56: error: ‘obj’ was not declared in this scope
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
remote:                                                                ^~~
remote:        ../src/common.h:90:61: error: expected primary-expression before ‘int’
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
remote:                                                                     ^~~
remote:        ../src/common.h:87:26: warning: variable templates only available with -std=c++14 or -std=gnu++14
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                  ^~~~~~
remote:        ../src/common.h:90:71: error: expected ‘;’ before ‘{’ token
remote:           template<typename T> T AttrTo(v8::Handle<v8::Object> obj, int attr) {
remote:                                                                               ^
remote:        ../src/common.h:96:9: error: ‘Handle’ is not a member of ‘v8’
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
remote:                 ^~~~~~
remote:        ../src/common.h:96:26: error: expected primary-expression before ‘>’ token
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
remote:                                  ^
remote:        ../src/common.h:96:28: error: ‘input’ was not declared in this scope
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
remote:                                    ^~~~~
remote:        ../src/common.h:96:28: note: suggested alternative: ‘ino_t’
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
remote:                                    ^~~~~
remote:                                    ino_t
remote:        ../src/common.h:96:70: error: expected primary-expression before ‘&’ token
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
remote:                                                                              ^
remote:        ../src/common.h:96:71: error: ‘buffersToPersist’ was not declared in this scope
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
remote:                                                                               ^~~~~~~~~~~~~~~~
remote:        ../src/common.h:96:87: error: expression list treated as compound expression in initializer [-fpermissive]
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist);
remote:                                                                                               ^
remote:        ../src/common.cc:34:20: error: redefinition of ‘bool sharp::HasAttr’
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                            ^~~~~~
remote:        In file included from ../src/common.cc:27:0:
remote:        ../src/common.h:82:8: note: ‘bool sharp::HasAttr’ previously defined here
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr);
remote:                ^~~~~~~
remote:        ../src/common.cc:34:20: error: ‘Handle’ is not a member of ‘v8’
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                            ^~~~~~
remote:        ../src/common.cc:34:37: error: expected primary-expression before ‘>’ token
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                             ^
remote:        ../src/common.cc:34:39: error: ‘obj’ was not declared in this scope
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                               ^~~
remote:        ../src/common.cc:34:56: error: expected primary-expression before ‘attr’
remote:           bool HasAttr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                ^~~~
remote:        ../src/common.cc:37:29: error: redefinition of ‘std::string sharp::AttrAsStr’
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                     ^~~~~~
remote:        In file included from ../src/common.cc:27:0:
remote:        ../src/common.h:83:15: note: ‘std::string sharp::AttrAsStr’ previously declared here
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr);
remote:                       ^~~~~~~~~
remote:        ../src/common.cc:37:29: error: ‘Handle’ is not a member of ‘v8’
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                     ^~~~~~
remote:        ../src/common.cc:37:46: error: expected primary-expression before ‘>’ token
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                      ^
remote:        ../src/common.cc:37:48: error: ‘obj’ was not declared in this scope
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                        ^~~
remote:        ../src/common.cc:37:65: error: expected primary-expression before ‘attr’
remote:           std::string AttrAsStr(v8::Handle<v8::Object> obj, std::string attr) {
remote:                                                                         ^~~~
remote:        ../src/common.cc:43:9: error: redefinition of ‘sharp::InputDescriptor* sharp::CreateInputDescriptor’
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
remote:                 ^~~~~~
remote:        In file included from ../src/common.cc:27:0:
remote:        ../src/common.h:95:20: note: ‘sharp::InputDescriptor* sharp::CreateInputDescriptor’ previously defined here
remote:           InputDescriptor* CreateInputDescriptor(
remote:                            ^~~~~~~~~~~~~~~~~~~~~
remote:        ../src/common.cc:43:9: error: ‘Handle’ is not a member of ‘v8’
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
remote:                 ^~~~~~
remote:        ../src/common.cc:43:26: error: expected primary-expression before ‘>’ token
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
remote:                                  ^
remote:        ../src/common.cc:43:28: error: ‘input’ was not declared in this scope
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
remote:                                    ^~~~~
remote:        ../src/common.cc:43:28: note: suggested alternative: ‘ino_t’
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
remote:                                    ^~~~~
remote:                                    ino_t
remote:        ../src/common.cc:43:70: error: expected primary-expression before ‘&’ token
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
remote:                                                                              ^
remote:        ../src/common.cc:43:71: error: ‘buffersToPersist’ was not declared in this scope
remote:             v8::Handle<v8::Object> input, std::vector<v8::Local<v8::Object>> &buffersToPersist
remote:                                                                               ^~~~~~~~~~~~~~~~
remote:        sharp.target.mk:134: recipe for target 'Release/obj.target/sharp/src/common.o' failed
remote:        make: *** [Release/obj.target/sharp/src/common.o] Error 1
remote:        make: Leaving directory '/tmp/build_37fd982bcb136d9ca481ab7e0b36cf53/node_modules/sharp/build'
remote:        gyp ERR! build error 
remote:        gyp ERR! stack Error: `make` failed with exit code: 2
remote:        gyp ERR! stack     at ChildProcess.onExit (/tmp/build_37fd982bcb136d9ca481ab7e0b36cf53/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
remote:        gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
remote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
remote:        gyp ERR! System Linux 4.4.0-1048-aws
remote:        gyp ERR! command "/tmp/build_37fd982bcb136d9ca481ab7e0b36cf53/.heroku/node/bin/node" "/tmp/build_37fd982bcb136d9ca481ab7e0b36cf53/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
remote:        gyp ERR! cwd /tmp/build_37fd982bcb136d9ca481ab7e0b36cf53/node_modules/sharp
remote:        gyp ERR! node -v v12.13.1
remote:        gyp ERR! node-gyp -v v5.0.5
remote:        gyp ERR! not ok 
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 1
remote:        npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
remote:        npm ERR! Exit status 1
remote:        npm ERR! 
remote:        npm ERR! Failed at the [email protected] install script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:        
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.XmXCU/_logs/2019-11-26T21_05_27_486Z-debug.log
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        Some possible problems:
remote:        
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to pure-everglades-46346.

Incorrect lockfile and Node version

The lockfile is a V2 lockfile, but the Node version is 14, which generates and needs a V1 lockfile. The Node version should probably be bumped to 18. This will generate a V2 lockfile and be ready for Gatsby V5.

Without these changes installs fail without deleting the lockfile, doing nvm use, and regenerating. The error message is:

07:49:44 AM:
 ERR! msgpackr-extract-darwin-arm64 not accessible from msgpackr-extract

07:49:44 AM:
npm

07:49:44 AM:
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gatsby/.npm/_logs/2023-02-02T15_49_44_211Z-debug.log

07:49:44 AM:
NPM ci --unsafe-perm --prefer-offline --no-audit --legacy-peer-deps failure - Command failed with exit code 1: npm ci --unsafe-perm --prefer-offline --no-audit --legacy-peer-deps --registry=https://registry.npmjs.org/
npm ERR! msgpackr-extract-darwin-arm64 not accessible from msgpackr-extract

Recommendation

  • Bump .nvmrc to 18
  • Regenerate lockfile

Fresh clone and npm install fails

I have looked at the related issues and believe this is different enough to warrant it's own issue. I have tried this on Node v13.9.0, v12.16.1, v11.15.0 with the same results.

Following the Contentful starter instructions, I've cloned this repository and run npm i. This fails with the following error:

> npm i                  
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'starter-gatsby-blog'
npm ERR! notarget 

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jimmy/.npm/_logs/2020-03-11T17_13_32_529Z-debug.log

I am on Ubuntu and I had a colleague try it on his macbook pro, with the same results.

unable to deploy my app

I am unable to deploy my app using Heroku with starter-gatsby-blog. When I am running the command git push heroku master, its not finishing and giving me following errors

TypeError: cannot read property "allContentfulBlogPost" of undefined

npm Error! code ELIFECYCLE
screenshot 19

npm Error! errno 1

below is the log from Heroku

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! /tmp/npmcache.6jsXf/_logs/2018-09-01T01_22_29_430Z-debug.log
-----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys
   
   Some possible problems:
   
   - Node version not specified in package.json
   https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
   
   Love,
   Heroku

! Push rejected, failed to compile Node.js app.
! Push failed

Can we please add the supported node version(s) somewhere?

Spent a decent chunk of time following a generic error trail when cloning the repo and attempting to install and run locally. Turns out the node version of 12 and another version of 8 I had installed are incompatible. Through trial and error, I found that v10.20.1 worked without a hitch. Can we add something like this to the package.json to at least provide a warning/hint to the user?

"engines": {
    "node": "=10.20.1",
    "npm": ">=6.0.0"
  },

If not, maybe just a note in the README? My npm version is 6.14.4 in case that helps anyone.

Update project dependencies

on npm audit you have found 21 vulnerabilities (4 low, 9 moderate, 7 high, 1 critical)

Full output:

                       === npm audit security report ===                        
                                                                                
# Run  npm install [email protected]  to resolve 12 vulnerabilities
SEMVER WARNING: Recommended action is a potentially breaking change
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > webpack-configurator > lodash                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > webpack-validator > lodash                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Missing Origin Validation                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ webpack-dev-server                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > webpack-dev-server                                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/725                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Critical      │ Command Injection                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ open                                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > webpack-dev-server > open                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/663                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ merge                                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > postcss-import > pkg-resolve > jspm > sane >        │
│               │ exec-sh > merge                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/722                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ merge                                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > webpack-validator > find-node-modules > merge       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/722                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Remote Code Execution                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ react-dev-utils                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > react-dev-utils                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/695                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Open Redirect                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ url-parse                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > react-dev-utils > sockjs-client > eventsource >     │
│               │ original > url-parse                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/678                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Open Redirect                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ url-parse                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > react-dev-utils > sockjs-client > url-parse         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/678                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Open Redirect                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ url-parse                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > webpack-dev-server > sockjs-client > eventsource >  │
│               │ original > url-parse                                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/678                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Open Redirect                                                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ url-parse                                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > webpack-dev-server > sockjs-client > url-parse      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/678                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Denial of Service                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ ws                                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby > remote-redux-devtools > socketcluster-client > ws   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/550                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


# Run  npm install [email protected]  to resolve 4 vulnerabilities
SEMVER WARNING: Recommended action is a potentially breaking change
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-plugin-sharp                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-plugin-sharp > imagemin-pngquant > pngquant-bin >     │
│               │ bin-build > download > caw > tunnel-agent                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-plugin-sharp                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-plugin-sharp > imagemin-pngquant > pngquant-bin >     │
│               │ bin-wrapper > download > caw > tunnel-agent                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-plugin-sharp                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-plugin-sharp > imagemin-webp > cwebp-bin > bin-build  │
│               │ > download > caw > tunnel-agent                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-plugin-sharp                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-plugin-sharp > imagemin-webp > cwebp-bin >            │
│               │ bin-wrapper > download > caw > tunnel-agent                  │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


# Run  npm install [email protected]  to resolve 4 vulnerabilities
SEMVER WARNING: Recommended action is a potentially breaking change
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-source-contentful                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-source-contentful > gatsby-plugin-sharp >             │
│               │ imagemin-pngquant > pngquant-bin > bin-build > download >    │
│               │ caw > tunnel-agent                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-source-contentful                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-source-contentful > gatsby-plugin-sharp >             │
│               │ imagemin-pngquant > pngquant-bin > bin-wrapper > download >  │
│               │ caw > tunnel-agent                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-source-contentful                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-source-contentful > gatsby-plugin-sharp >             │
│               │ imagemin-webp > cwebp-bin > bin-build > download > caw >     │
│               │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Memory Exposure                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-source-contentful                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-source-contentful > gatsby-plugin-sharp >             │
│               │ imagemin-webp > cwebp-bin > bin-wrapper > download > caw >   │
│               │ tunnel-agent                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/598                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


# Run  npm update underscore.string --depth 2  to resolve 1 vulnerability
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ underscore.string                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ gatsby-transformer-remark                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ gatsby-transformer-remark > underscore.string                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/745                       │
└───────────────┴──────────────────────────────────────────────────────────────┘


found 21 vulnerabilities (4 low, 9 moderate, 7 high, 1 critical) in 25571 scanned packages
  run `npm audit fix` to fix 1 of them.
  20 vulnerabilities require semver-major dependency updates.

npm install EINTEGRITY fails with yargs-parser

During npm install, an EINTEGRITY error prevents the process from completing. It looks like the offending package is yargs-parser, which is a dependency of webpack-dev-server, gatsby, and contentful-import.

error sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== integrity checksum failed when using sha512: wanted sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ== but got sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==. (15450 bytes)

The locked version of yargs-parser (as a dependency of those packages) is 13.1.2

Instant fail: ERROR #85910 Multiple "root" queries

Get the following error immediately after clone, install, and setup on my machine running Windows 10:

"Multiple "root" queries found: "BlogIndexQuery" and "BlogIndexQuery".
Only the first ("BlogIndexQuery") will be registered. ERROR #85910"

Which doesn't make any sense at all because there is only one BlogIndexQuery in the GraphQL request. Run dev has a hard time reading the project files properly on windows it looks like.

Very similar to this issue within the context of a different Gatsby project. Tried all of the solutions given on this thread to no avail: gatsbyjs/gatsby#19863

This works fine on my mac which is great, but I'm just wondering why this doesn't seem to be very Windows friendly.

30 vulnerabilities found 7 Moderate | 23 High

Hi, I'm new to gatsby,

I used the command :
gatsby new contentful-starter-blog https://github.com/contentful/starter-gatsby-blog/

then with yarn audit a warning warns of 30 vulnerabilities 7 moderate and 23 high.
I tried to fix with yarn audit fix --force but also update each package manually but nothing changes.

I guess the problem comes directly from this repo?
Is it here that the version upgrades to fix the problems should be done and not on my machine?

Or do I have to use a specific command other than yarn upgrade ?

Can't upload images in Post Body

Hi - it seems the Post Body is not setup to handle any images? I get the following error on the Netlify Build:

7:30:33 PM: error There was an error in your GraphQL query:
7:30:33 PM: Input file contains unsupported image format
7:30:33 PM:    1 | fragment GatsbyContentfulFluid_tracedSVG on ContentfulFluid {
7:30:33 PM: >  2 |   tracedSVG
7:30:33 PM:      |   ^
7:30:33 PM:    3 |   aspectRatio
7:30:33 PM:    4 |   src
7:30:33 PM:    5 |   srcSet
7:30:33 PM:    6 |   sizes
7:30:33 PM:    7 | }
7:30:33 PM:    8 |
7:30:33 PM:    9 | query HomeQuery {
7:30:33 PM:   10 |   allContentfulBlogPost(sort: {fields: [publishDate], order: DESC}) {
7:30:33 PM:   11 |     edges {
7:30:33 PM:   12 |       node {
7:30:33 PM: File path: /opt/build/repo/src/pages/index.js
7:30:33 PM: Url path: /
7:30:33 PM: Plugin: none

Is there a way to fix this?
Thanks,

Install script issues

Just tested this after creating a new free account. The command to do the install includes both a CDA and CMA token, yet you are prompted to enter the CDA token anyway. Plus, in the workflow from the new user account on contentful.com you cannot easily navigate to the API Keys page. Finally, the text about the CMA, CDA and CPA tokens in the script don't make sense as well as the text about finding the Space id.
Screen Shot 2020-07-15 at 12 22 52 PM
starter gatsby blog install

USE AT YOUR OWN RISK

If you are thinking of using this for a real world project, you will need to upgrade to GATSBY 2.0 (breaking) and change multiple things, gatsby has a blog of what breaks.. I would highly recommend doing the upgrade before using this.

[question] CI and accessToken

Hello, i have a question about CI and accessToken

I would like to use github CI ( action ) to build gatsby and publish
for this, github need to access to content full api, but, I dont want to push spaceID and accessToken

how can i do it without security hole

Thanks

Where does allContentfulPerson, etc come from?

I'm coming from there:
https://app.contentful.com/spaces/tns8ne4b11g0/onboarding/explore

It mentions

async function getPeople() {
  const entries = await client.getEntries({ content_type: 'person' })
  return entries.items
}

However, this is nowhere in the src code. The code uses this:

export const pageQuery = graphql`
  query ArbitraryNameHomeQuery {
    allContentfulBlogPost(sort: { fields: [publishDate], order: DESC }) {
      edges {
        node {
          title
          slug
          publishDate(formatString: "MMMM Do, YYYY")
          tags
          heroImage {
            sizes(maxWidth: 350, maxHeight: 196, resizingBehavior: SCALE) {
             ...GatsbyContentfulSizes_withWebp
            }
          }
          description {
            childMarkdownRemark {
              html
            }
          }
        }
      }
    }
    allContentfulPerson(filter: { id: { eq: "c15jwOBqpxqSAOy2eOO4S0m" } }) {
      edges {
        node {
          name
          shortBio {
            shortBio
          }
          title
          heroImage: image {
            sizes(
              maxWidth: 1180
              maxHeight: 480
              resizingBehavior: PAD
              background: "rgb:000000"
            ) {
              ...GatsbyContentfulSizes_withWebp
            }
          }
        }
      }
    }
  }
`

Where does allContentfulPerson come from?

Running "npm run setup" results in Server 504 error occurred

How to reproduce

I was follwing the "Gatsby Starter for Contentful" getting started guide and when running the npm run setup the error below occured.

  • Node v10.15.0
  • npm 6.9.0
  • Gatsby CLI version: 2.7.53
  • Gatsby version: 1.9.277

Consequences

The project does start when doing a npm run dev, but it shows some React error after loading up the browser at http://localhost:8000.

TypeError: Cannot read property '0' of undefined
RootIndex.render
src/pages/index.js:8
   5 | import ArticlePreview from '../components/article-preview'
   6 | 
   7 | class RootIndex extends React.Component {
>  8 |   render() {
   9 |     const siteTitle = get(this, 'props.data.site.siteMetadata.title')
  10 |     const posts = get(this, 'props.data.allContentfulBlogPost.edges')
  11 |     const [author] = get(this, 'props.data.allContentfulPerson.edges')

Log output

» npm run setup -- --spaceId [hidden] --deliveryToken [hidden] --managementToken [hidden]

> [email protected] setup /Users/[removed-for-privacy-reasons]/starter-gatsby-blog
> npm install --no-save contentful-import yargs-parser axios chalk && node ./setup.js "--spaceId" "[hidden]" "--deliveryToken" "[hidden]" "--managementToken" "[hidden]"

npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN [email protected] requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.

+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 151 packages from 37 contributors, updated 5 packages and audited 25571 packages in 12.259s
found 1088 vulnerabilities (30 low, 17 moderate, 1040 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

Writing config file...

Config file /Users/[removed-for-privacy-reasons]/starter-gatsby-blog/.contentful.json written

┌──────────────────────────────────────────────────┐
│ The following entities are going to be imported: │
├─────────────────────────────────┬────────────────┤
│ Content Types                   │ 2              │
├─────────────────────────────────┼────────────────┤
│ Editor Interfaces               │ 2              │
├─────────────────────────────────┼────────────────┤
│ Entries                         │ 4              │
├─────────────────────────────────┼────────────────┤
│ Assets                          │ 4              │
├─────────────────────────────────┼────────────────┤
│ Locales                         │ 1              │
├─────────────────────────────────┼────────────────┤
│ Webhooks                        │ 0              │
└─────────────────────────────────┴────────────────┘
 ✔ Validating content-file
 ✔ Initialize client (1s)
 ✔ Checking if destination space already has any content and retrieving it (1s)
 ✔ Apply transformations to source data (1s)
 ✔ Push content to destination space
   ✔ Connecting to space (1s)
   ✔ Importing Locales (1s)
   ✔ Importing Content Types (4s)
   ✔ Publishing Content Types (2s)
   ✔ Importing Editor Interfaces (1s)
   ✔ Importing Assets (9s)
   ✔ Publishing Assets (2s)
   ✔ Archiving Assets (0s)
   ✔ Importing Content Entries (4s)
   ✔ Publishing Content Entries (3s)
   ✔ Archiving Entries (0s)
   ✔ Creating Web Hooks (0s)
Finished importing all data
┌───────────────────────┐
│ Imported entities     │
├───────────────────┬───┤
│ Locales           │ 1 │
├───────────────────┼───┤
│ Content Types     │ 2 │
├───────────────────┼───┤
│ Editor Interfaces │ 2 │
├───────────────────┼───┤
│ Assets            │ 2 │
├───────────────────┼───┤
│ Published Assets  │ 2 │
├───────────────────┼───┤
│ Archived Assets   │ 0 │
├───────────────────┼───┤
│ Entries           │ 4 │
├───────────────────┼───┤
│ Published Entries │ 4 │
├───────────────────┼───┤
│ Archived Entries  │ 0 │
├───────────────────┼───┤
│ Webhooks          │ 0 │
└───────────────────┴───┘
The import took a few seconds (22s)


The following 2 errors and 2 warnings occurred:

11:26:49 - Server 504 error occurred. Waiting for 2110 ms before retrying...
11:26:51 - Server 504 error occurred. Waiting for 2014 ms before retrying...
11:26:73 - VersionMismatch: Status: 409 - Conflict - Message:  - Request ID: 3b7e2c49dcb03dfb45e2fab72df3047b
11:26:89 - VersionMismatch: Status: 409 - Conflict - Message:  - Request ID: 60ab426470fc0dcf7db21632a7997f10

Stored the detailed error log file at:
/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/contentful-import-error-log-1oxbsko5fp7k-2019-10-02T11-26-06.json
{ ContentfulMultiError: Errors occured
    at then (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/contentful-import/dist/index.js:202:28)
    at tryCatcher (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/[removed-for-privacy-reasons]/starter-gatsby-blog/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
  name: 'ContentfulMultiError',
  errors:
   [ { ts: '2019-10-02T09:26:09.732Z',
       level: 'error',
       error: [Object] },
     { ts: '2019-10-02T09:26:09.899Z',
       level: 'error',
       error: [Object] } ] }

Npm Install fails

Attempting to npm install after cloning the repo fails with no clear fix. Here is the summary terminal output:

Summary:
fatal error: too many errors emitted, stopping now [-ferror-limit=]
10 warnings and 20 errors generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/Cellar/node/12.4.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/paul.briar/Desktop/Learning/Gatsby/starter-gatsby-blog/node_modules/sharp
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install 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! /Users/paul.briar/.npm/_logs/2019-07-10T12_51_08_422Z-debug.log

The wrong Contentful access token is being set in the Heroku onboarding walkthrough.

First off, really enjoying my trip through Contentful's trial :).

I ran into a small hitch when following your onboarding documentation at https://app.contentful.com/spaces/my-space-id/onboarding/deploy for getting started on Heroku.

The fifth step that sets the Heroku config variables appears to use an outdated config token name CONTENTFUL_DELIVERY_TOKEN instead of CONTENTFUL_ACCESS_TOKEN which is used in the gatsby-config.js file among others:

Screen Shot 2020-08-05 at 2 35 48 PM

Deploying the app the first time gave me an error:

Screen Shot 2020-08-05 at 2 27 23 PM

Changing the token from CONTENTFUL_DELIVERY_TOKEN to CONTENTFUL_ACCESS_TOKEN in my Heroku dashboard's Settings -> Config vars section did the trick and the next deploy worked perfectly.

Color of GatsbyContentfulFluid_tracedSVG fill

Basically the same "issue" as on gatsby-image: gatsbyjs/gatsby#14245

Loving using Contentful with gatsby-image, but would be nice to be able to use a query to change the fill color from the default light gray. Gatsby-plugin-sharp has this built into their query with traceSVG: { background: "#fbfafc", color: "#dbd4e2" } - any chance of something like this that would be easily reproducable with Contentful?

Consider deprecating?

Seems like the functionality has largely been superseded by contentful-userland/gatsby-contentful-starter, which seems to be a drastically improved experience.

Cannot query field "references" on type "ContentfulBlogPostBody"

Yesterday (August 3rd, 2022), I created a Contentful account and cloned this repo. I ran npm i, npm run setup, and npm run dev. That last command led to this output:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\r\starter-gatsby-blog> npm run dev
> [email protected] dev
> gatsby develop
success compile gatsby files - 2.756s
success load gatsby config - 0.019s
success load plugins - 1.028s
success onPreInit - 0.008s
success initialize cache - 0.033s
success copy gatsby files - 0.261s
success Compiling Gatsby Functions - 0.375s
success onPreBootstrap - 0.394s
success createSchemaCustomization - 0.195s
success Contentful: Sync changed items - 0.194s - 1/1 5.15/s
success Contentful: Fetch data - 0.524s
info Contentful: 0 new entries                                                                                                                             
info Contentful: 0 updated entries                                                                                                                         
info Contentful: 0 deleted entries                                                                                                                         
info Contentful: 7 cached entries
info Contentful: 0 new assets                                                                                                                              
info Contentful: 0 updated assets                                                                                                                          
info Contentful: 5 cached assets                                                                                                                           
info Contentful: 0 deleted assets
success Contentful: Create nodes - 0.016s
success Contentful: Process data - 0.060s
success Checking for changed pages - 0.001s                                                                                                                
success source and transform nodes - 0.704s                                                                                                                
success building schema - 0.445s
success createPages - 0.023s
success createPagesStatefully - 0.056s
info Total nodes: 52, SitePage nodes: 6 (use --verbose for breakdown)                                                                                      
success Checking for changed pages - 0.002s                                                                                                                
success write out redirect data - 0.002s                                                                                                                   
success onPostBootstrap - 0.002s
info bootstrap finished - 9.302s                                                                                                                           
success onPreExtractQueries - 0.001s                                                                                                                       

 ERROR #85923  GRAPHQL

There was an error in your GraphQL query:

Cannot query field "references" on type "ContentfulBlogPostBody".

If you don't expect "references" to exist on the type "ContentfulBlogPostBody" it is most likely a typo.
However, if you expect "references" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and 
what shape they have
- You want to optionally use your field "references" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL
 schema. A quick fix is to add at least one entry with that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". 
Visit our docs to learn how you can define the schema for "ContentfulBlogPostBody":
https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization#creating-type-definitions


C:\r\starter-gatsby-blog\src\templates\blog-post.js
  115:9  error  Cannot query field "references" on type "ContentfulBlogPostBody"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)


failed Building development bundle - 4.690s
ERROR in
C:\r\starter-gatsby-blog\src\templates\blog-post.js
  115:9  error  Cannot query field "references" on type "ContentfulBlogPostBody"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)


develop compiled with 1 error
success Writing page-data.json files to public directory - 0.125s - 2/6 48.13/s
Restarting function watcher due to change to "C:\r\starter-gatsby-blog\.env.development"
success Re-building functions
Restarting function watcher due to change to "C:\r\starter-gatsby-blog\.env.development"
success Re-building functions
Restarting function watcher due to change to "C:\r\starter-gatsby-blog\.env.development"
success Re-building functions

The main error of interest here is:

There was an error in your GraphQL query:

Cannot query field "references" on type "ContentfulBlogPostBody".

Note that I logged into Contentful and verified it seemed to create all the content types and content nodes fine.

I am thinking the error is related to this bit of code in blog-post.js:

      body {
        raw
        references {
          ... on ContentfulAsset {
            contentful_id
            title
            description
            gatsbyImage(width: 1000)
            __typename
          }
        }
      }

The part that mentions "references". I am not super familiar with Gatsby/GraphQL/Contentful, so not sure exactly what the issue/fix is, but it seems like it's probably related to the code mentioned above.

That references block of code seems to have been added a few days ago in this commit: 863c048 ("Adding inline images to body of blog post")

EDIT: If I remove the following:

        references {
          ... on ContentfulAsset {
            contentful_id
            title
            description
            gatsbyImage(width: 1000)
            __typename
          }
        }

Then it seems to work fine. I imagine there was some purpose for that though, so unsure of the implications of removing it.

<?php

responseCode = $errorCode; // если надо получать файл и строку в которой получена ошибка // $message = "Error in {$this->getFile()}, line: {$this->getLine()}: {$this->errorCodes[$errorCode]}"; $message = "{$this->errorCodes[$errorCode]}"; parent::__construct($message); } protected $errorCodes = array( 'ACCESS_ACTIVATION' => 'Сервис успешно активирован', 'ACCESS_CANCEL' => 'активация отменена', 'ACCESS_READY' => 'Ожидание нового смс', 'ACCESS_RETRY_GET' => 'Готовность номера подтверждена', 'ACCOUNT_INACTIVE' => 'Свободных номеров нет', 'ALREADY_FINISH' => 'Аренда уже завершена', 'ALREADY_CANCEL' => 'Аренда уже отменена', 'BAD_ACTION' => 'Некорректное действие (параметр action)', 'BAD_SERVICE' => 'Некорректное наименование сервиса (параметр service)', 'BAD_KEY' => 'Неверный API ключ доступа', 'BAD_STATUS' => 'Попытка установить несуществующий статус', 'BANNED' => 'Аккаунт заблокирован', 'CANT_CANCEL' => 'Невозможно отменить аренду (прошло более 20 мин.)', 'ERROR_SQL' => 'Один из параметров имеет недопустимое значение', 'NO_NUMBERS' => 'Нет свободных номеров для приёма смс от текущего сервиса', 'NO_BALANCE' => 'Закончился баланс', 'NO_YULA_MAIL' => 'Необходимо иметь на счету более 500 рублей для покупки сервисов холдинга Mail.ru и Mamba', 'NO_CONNECTION' => 'Нет соединения с серверами sms-activate', 'NO_ID_RENT' => 'Не указан id аренды', 'NO_ACTIVATION' => 'Указанного id активации не существует', 'STATUS_CANCEL' => 'Активация/аренда отменена', 'STATUS_FINISH' => 'Аренда оплачена и завершена', 'STATUS_WAIT_CODE' => 'Ожидание первой смс', 'STATUS_WAIT_RETRY' => 'ожидание уточнения кода', 'SQL_ERROR' => 'Один из параметров имеет недопустимое значение', 'INVALID_PHONE' => 'Номер арендован не вами (неправильный id аренды)', 'INCORECT_STATUS' => 'Отсутствует или неправильно указан статус', 'WRONG_SERVICE' => 'Сервис не поддерживает переадресацию', 'WRONG_SECURITY' => 'Ошибка при попытке передать ID активации без переадресации, или же завершенной/не активной активации' ); public function getResponseCode() { return $this->errorCodes[$this->responseCode]; } } class ErrorCodes extends RequestError { public function checkExist($errorCode) { return array_key_exists($errorCode, $this->errorCodes); } } class SMSActivate { private $url = 'https://api.sms-activate.org/stubs/handler_api.php'; private $apiKey; public function __construct($apiKey) { $this->apiKey = $apiKey; } public function getBalance() { return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__), 'GET'); } public function getBalanceAndCashBack() { return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__), 'GET'); } public function getTopCountriesByService($service = '', $freePrice = false) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, '$freePrice' => $freePrice); return $this->request($requestParam, 'POST', true); } public function getNumbersStatus($country = null, $operator = null) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__); if ($country) { $requestParam['country'] = $country; } if ($operator && ($country == 0 || $country == 1 || $country == 2)) { $requestParam['service'] = $operator; } $response = array(); $changeKeys = $this->request($requestParam, 'GET', true); foreach ($changeKeys as $services => $count) { $services = trim($services, "_01"); $response[$services] = $count; } unset($changeKeys); return $response; } public function getNumber($service, $country = null, $forward = 0, $operator = null, $ref = null) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, 'forward' => $forward); if ($country) { $requestParam['country'] = $country; } if ($operator && ($country == 0 || $country == 1 || $country == 2)) { $requestParam['operator'] = $operator; } if ($ref) { $requestParam['ref'] = $ref; } return $this->request($requestParam, 'POST', null, 1); } public function getMultiServiceNumber($services, $forward = 0, $country = null, $operator = null, $ref = null) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'multiService' => $services, 'forward' => $forward); if ($country) { $requestParam['country'] = $country; } if ($operator && ($country == 0 || $country == 1 || $country == 2)) { $requestParam['operator'] = $operator; } if ($ref) { $requestParam['ref'] = $ref; } return $this->request($requestParam, 'POST', true, 1); } public function setStatus($id, $status, $forward = 0) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'status' => $status); if ($forward) { $requestParam['forward'] = $forward; } return $this->request($requestParam, 'POST', null, 3); } public function getStatus($id) { return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id), 'GET', false, 2); } public function getCountries() { return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__), 'GET', true); } public function getAdditionalService($service, $activationId) { return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, 'id' => $activationId), 'GET', false, 1); } public function getFullSms($id) { return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id), 'GET'); } public function getPrices($country = null, $service = null) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__); if ($country !== null) { $requestParam['country'] = $country; } if ($service) { $requestParam['service'] = $service; } return $this->request($requestParam, 'GET', true); } public function getRentServicesAndCountries($time = 4, $operator = "any") { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'rent_time' => $time, 'operator' => $operator); return $this->requestRent($requestParam, 'POST', true); } public function getRentNumber($service, $time = 4, $country = 0, $operator = "any", $url = '') { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, 'rent_time' => $time, 'operator' => $operator, 'country' => $country, 'url' => $url); return $this->requestRent($requestParam, 'POST', true); } public function getRentStatus($id) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id); return $this->requestRent($requestParam, 'POST', true); } public function setRentStatus($id, $status) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'status' => $status); return $this->requestRent($requestParam, 'POST', true); } public function getRentList() { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__); return $this->requestRent($requestParam, 'POST', true); } public function continueRentNumber($id, $time = 4) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'rent_time' => $time); return $this->requestRent($requestParam, 'POST', true); } public function getContinueRentPriceNumber($id, $time) { $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'rent_time' => $time); return $this->requestRent($requestParam, 'POST', false); } /** * @param $data * @param $method * @param null $parseAsJSON * @return mixed */ private function request($data, $method, $parseAsJSON = null, $getNumber = null) { $method = strtoupper($method); if (!in_array($method, array('GET', 'POST'))) { throw new InvalidArgumentException('Method can only be GET or POST'); } $serializedData = http_build_query($data); if ($method === 'GET') { $result = file_get_contents("$this->url?$serializedData"); } else { $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => $serializedData ) ); $context = stream_context_create($options); $result = file_get_contents($this->url, false, $context); } $responseError = new ErrorCodes($result); $check = $responseError->checkExist($result); try { if ($check) { throw new RequestError($result); } } catch (Exception $e) { return $e->getResponseCode(); } if ($parseAsJSON) { return json_decode($result, true); } $parsedResponse = explode(':', $result); if ($getNumber == 1) { return array('id' => $parsedResponse[1], 'number' => $parsedResponse[2]); } if ($getNumber == 2) { return array('status' => $parsedResponse[0], 'code' => $parsedResponse[1]); } if ($getNumber == 3) { return array('status' => $parsedResponse[0]); } return $parsedResponse[1]; } private function requestRent($data, $method, $parseAsJSON = null, $getNumber = null) { $method = strtoupper($method); if (!in_array($method, array('GET', 'POST'))) { throw new InvalidArgumentException('Method can only be GET or POST'); } $serializedData = http_build_query($data); if ($method === 'GET') { $request_url = "$this->url?$serializedData"; $result = file_get_contents($request_url); } else { $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => $serializedData ) ); $context = stream_context_create($options); $result = file_get_contents($this->url, false, $context); } if ($parseAsJSON) { $result = json_decode($result, true); // $responsError = new ErrorCodes($result["message"]); // $check = $responsError->checkExist($result["message"]); // раскоментить если необходимо включить исключения для Аренды // if ($check) { // throw new RequestError($result["message"]); // } return $result; } return $result; } } - [ ] `#[](url)` _Originally posted by @ZKL2337 in https://github.com//issues/184#issuecomment-1024920985_

抓取云端数据

``<?php

class RequestError extends Exception
{
private $responseCode;

public function __construct($errorCode)
{
    $this->responseCode = $errorCode;

// если надо получать файл и строку в которой получена ошибка
// $message = "Error in {$this->getFile()}, line: {$this->getLine()}: {$this->errorCodes[$errorCode]}";
$message = "{$this->errorCodes[$errorCode]}";
parent::__construct($message);
}

protected $errorCodes = array(
    'ACCESS_ACTIVATION' => 'Сервис успешно активирован',
    'ACCESS_CANCEL'     => 'активация отменена',
    'ACCESS_READY'      => 'Ожидание нового смс',
    'ACCESS_RETRY_GET'  => 'Готовность номера подтверждена',
    'ACCOUNT_INACTIVE'  => 'Свободных номеров нет',
    'ALREADY_FINISH'    => 'Аренда уже завершена',
    'ALREADY_CANCEL'    => 'Аренда уже отменена',
    'BAD_ACTION'        => 'Некорректное действие (параметр action)',
    'BAD_SERVICE'       => 'Некорректное наименование сервиса (параметр service)',
    'BAD_KEY'           => 'Неверный API ключ доступа',
    'BAD_STATUS'        => 'Попытка установить несуществующий статус',
    'BANNED'            => 'Аккаунт заблокирован',
    'CANT_CANCEL'       => 'Невозможно отменить аренду (прошло более 20 мин.)',
    'ERROR_SQL'         => 'Один из параметров имеет недопустимое значение',
    'NO_NUMBERS'        => 'Нет свободных номеров для приёма смс от текущего сервиса',
    'NO_BALANCE'        => 'Закончился баланс',
    'NO_YULA_MAIL'      => 'Необходимо иметь на счету более 500 рублей для покупки сервисов холдинга Mail.ru и Mamba',
    'NO_CONNECTION'     => 'Нет соединения с серверами sms-activate',
    'NO_ID_RENT'        => 'Не указан id аренды',
    'NO_ACTIVATION'     => 'Указанного id активации не существует',
    'STATUS_CANCEL'     => 'Активация/аренда отменена',
    'STATUS_FINISH'     => 'Аренда оплачена и завершена',
    'STATUS_WAIT_CODE'  => 'Ожидание первой смс',
    'STATUS_WAIT_RETRY' => 'ожидание уточнения кода',
    'SQL_ERROR'         => 'Один из параметров имеет недопустимое значение',
    'INVALID_PHONE'     => 'Номер арендован не вами (неправильный id аренды)',
    'INCORECT_STATUS'   => 'Отсутствует или неправильно указан статус',
    'WRONG_SERVICE'     => 'Сервис не поддерживает переадресацию',
    'WRONG_SECURITY'    => 'Ошибка при попытке передать ID активации без переадресации, или же завершенной/не активной активации'
);

public function getResponseCode()
{
    return $this->errorCodes[$this->responseCode];
}

}

class ErrorCodes extends RequestError
{
public function checkExist($errorCode)
{
return array_key_exists($errorCode, $this->errorCodes);
}
}

class SMSActivate
{
private $url = 'https://api.sms-activate.org/stubs/handler_api.php';

private $apiKey;

public function __construct($apiKey)
{
    $this->apiKey = $apiKey;
}

public function getBalance()
{
    return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__), 'GET');
}

public function getBalanceAndCashBack()
{
    return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__), 'GET');
}

public function getTopCountriesByService($service = '', $freePrice = false)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, '$freePrice' => $freePrice);
    return $this->request($requestParam, 'POST', true);
}

public function getNumbersStatus($country = null, $operator = null)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__);
    if ($country) {
        $requestParam['country'] = $country;
    }
    if ($operator && ($country == 0 || $country == 1 || $country == 2)) {
        $requestParam['service'] = $operator;
    }
    $response = array();
    $changeKeys = $this->request($requestParam, 'GET', true);
    foreach ($changeKeys as $services => $count) {
        $services = trim($services, "_01");
        $response[$services] = $count;
    }
    unset($changeKeys);
    return $response;
}

public function getNumber($service, $country = null, $forward = 0, $operator = null, $ref = null)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, 'forward' => $forward);
    if ($country) {
        $requestParam['country'] = $country;
    }
    if ($operator && ($country == 0 || $country == 1 || $country == 2)) {
        $requestParam['operator'] = $operator;
    }
    if ($ref) {
        $requestParam['ref'] = $ref;
    }
    return $this->request($requestParam, 'POST', null, 1);
}

public function getMultiServiceNumber($services, $forward = 0, $country = null, $operator = null, $ref = null)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'multiService' => $services, 'forward' => $forward);
    if ($country) {
        $requestParam['country'] = $country;
    }
    if ($operator && ($country == 0 || $country == 1 || $country == 2)) {
        $requestParam['operator'] = $operator;
    }
    if ($ref) {
        $requestParam['ref'] = $ref;
    }
    return $this->request($requestParam, 'POST', true, 1);
}

public function setStatus($id, $status, $forward = 0)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'status' => $status);

    if ($forward) {
        $requestParam['forward'] = $forward;
    }

    return $this->request($requestParam, 'POST', null, 3);
}

public function getStatus($id)
{
    return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id), 'GET', false, 2);
}

public function getCountries()
{
    return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__), 'GET', true);
}

public function getAdditionalService($service, $activationId)
{
    return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, 'id' => $activationId), 'GET', false, 1);
}

public function getFullSms($id)
{
    return $this->request(array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id), 'GET');
}

public function getPrices($country = null, $service = null)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__);

    if ($country !== null) {
        $requestParam['country'] = $country;
    }
    if ($service) {
        $requestParam['service'] = $service;
    }

    return $this->request($requestParam, 'GET', true);
}

public function getRentServicesAndCountries($time = 4, $operator = "any")
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'rent_time' => $time, 'operator' => $operator);
    return $this->requestRent($requestParam, 'POST', true);
}

public function getRentNumber($service, $time = 4, $country = 0, $operator = "any", $url = '')
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'service' => $service, 'rent_time' => $time, 'operator' => $operator, 'country' => $country, 'url' => $url);
    return $this->requestRent($requestParam, 'POST', true);
}

public function getRentStatus($id)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id);
    return $this->requestRent($requestParam, 'POST', true);
}

public function setRentStatus($id, $status)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'status' => $status);
    return $this->requestRent($requestParam, 'POST', true);
}

public function getRentList()
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__);
    return $this->requestRent($requestParam, 'POST', true);
}

public function continueRentNumber($id, $time = 4)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'rent_time' => $time);
    return $this->requestRent($requestParam, 'POST', true);
}

public function getContinueRentPriceNumber($id, $time)
{
    $requestParam = array('api_key' => $this->apiKey, 'action' => __FUNCTION__, 'id' => $id, 'rent_time' => $time);
    return $this->requestRent($requestParam, 'POST', false);
}

/**
 * @param $data
 * @param $method
 * @param null $parseAsJSON
 * @return mixed
 */
private function request($data, $method, $parseAsJSON = null, $getNumber = null)
{
    $method = strtoupper($method);

    if (!in_array($method, array('GET', 'POST'))) {
        throw new InvalidArgumentException('Method can only be GET or POST');
    }

    $serializedData = http_build_query($data);

    if ($method === 'GET') {
        $result = file_get_contents("$this->url?$serializedData");
    } else {
        $options = array(
            'http' => array(
                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
                'method' => 'POST',
                'content' => $serializedData
            )
        );
        $context = stream_context_create($options);
        $result = file_get_contents($this->url, false, $context);
    }

    $responseError = new ErrorCodes($result);
    $check = $responseError->checkExist($result);

    try {
        if ($check) {
            throw new RequestError($result);
        }
    } catch (Exception $e) {
        return $e->getResponseCode();
    }

    if ($parseAsJSON) {
        return json_decode($result, true);
    }

    $parsedResponse = explode(':', $result);

    if ($getNumber == 1) {
        return array('id' => $parsedResponse[1], 'number' => $parsedResponse[2]);
    }
    if ($getNumber == 2) {
        return array('status' => $parsedResponse[0], 'code' => $parsedResponse[1]);
    }
    if ($getNumber == 3) {
        return array('status' => $parsedResponse[0]);
    }
    return $parsedResponse[1];
}

private function requestRent($data, $method, $parseAsJSON = null, $getNumber = null)
{
    $method = strtoupper($method);

    if (!in_array($method, array('GET', 'POST'))) {
        throw new InvalidArgumentException('Method can only be GET or POST');
    }
    $serializedData = http_build_query($data);

    if ($method === 'GET') {
        $request_url = "$this->url?$serializedData";
        $result = file_get_contents($request_url);
    } else {
        $options = array(
            'http' => array(
                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
                'method' => 'POST',
                'content' => $serializedData
            )
        );
        $context = stream_context_create($options);
        $result = file_get_contents($this->url, false, $context);
    }

    if ($parseAsJSON) {
        $result = json_decode($result, true);

// $responsError = new ErrorCodes($result["message"]);
// $check = $responsError->checkExist($result["message"]); // раскоментить если необходимо включить исключения для Аренды
// if ($check) {
// throw new RequestError($result["message"]);
// }
return $result;
}
return $result;
}
}

npm run dev - 'Something went wrong installing the "sharp" module'

I get the error in the title when running npm run dev. Full output:

$ npm run dev

> [email protected] dev
> gatsby develop


 ERROR  UNKNOWN

(node:40066) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)



 ERROR  UNKNOWN

(node:40094) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

success compile gatsby files - 1.028s
success load gatsby config - 0.018s

 ERROR  UNKNOWN

Error in "/home/harry/Documents/contentful-starter/node_modules/gatsby-transformer-sharp/gatsby-node":
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp-linux-x64.node'
Require stack:
- /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/sharp.js
- /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/constructor.js
- /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/index.js
- /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/safe-sharp.js
- /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/index.js
- /home/harry/Documents/contentful-starter/node_modules/gatsby-transformer-sharp/customize-schema.js
- /home/harry/Documents/contentful-starter/node_modules/gatsby-transformer-sharp/gatsby-node.js

Possible solutions:
- Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
- Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install



  Error: Something went wrong installing the "sharp" module
  Cannot find module '../build/Release/sharp-linux-x64.node'
  Require stack:
  - /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/sharp.js
  - /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/constructor.js
  - /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/index.js
  - /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/safe-sharp.js
  - /home/harry/Documents/contentful-starter/node_modules/gatsby-plugin-sharp/index.js
  - /home/harry/Documents/contentful-starter/node_modules/gatsby-transformer-sharp/customize-schema.js
  - /home/harry/Documents/contentful-starter/node_modules/gatsby-transformer-sharp/gatsby-node.js
  Possible solutions:
  - Install with verbose logging and look for errors: "npm install --ignore-scripts=false --foreground-scripts --verbose sharp"
  - Install for the current linux-x64 runtime: "npm install --platform=linux --arch=x64 sharp"
  - Consult the installation documentation: https://sharp.pixelplumbing.com/install
  
  - sharp.js:34 Object.<anonymous>
    [contentful-starter]/[gatsby-plugin-sharp]/[sharp]/lib/sharp.js:34:9
  
  - loader:1378 Module._compile
    node:internal/modules/cjs/loader:1378:14
  
  - loader:1437 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1437:10
  
  - loader:1212 Module.load
    node:internal/modules/cjs/loader:1212:32
  
  - loader:1028 Function.Module._load
    node:internal/modules/cjs/loader:1028:12
  
  - loader:1237 Module.require
    node:internal/modules/cjs/loader:1237:19
  
  - helpers:176 require
    node:internal/modules/helpers:176:18
  
  - constructor.js:8 Object.<anonymous>
    [contentful-starter]/[gatsby-plugin-sharp]/[sharp]/lib/constructor.js:8:1
  
  - loader:1378 Module._compile
    node:internal/modules/cjs/loader:1378:14
  
  - loader:1437 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1437:10
  
  - loader:1212 Module.load
    node:internal/modules/cjs/loader:1212:32
  
  - loader:1028 Function.Module._load
    node:internal/modules/cjs/loader:1028:12
  
  - loader:1237 Module.require
    node:internal/modules/cjs/loader:1237:19
  
  - helpers:176 require
    node:internal/modules/helpers:176:18
  
  - index.js:3 Object.<anonymous>
    [contentful-starter]/[gatsby-plugin-sharp]/[sharp]/lib/index.js:3:15
  
  - loader:1378 Module._compile
    node:internal/modules/cjs/loader:1378:14
  

not finished load plugins - 0.913s

Environment

node.js: 21.6.2
npm: 10.4.0
gatsby-cli: 5.13.2

Starter won't build locally

Hi,

Thanks for the starter!

I followed the onboarding and can run locally with npm run dev but when I build and try to serve it locally I get a config error, which is weird because if there was a config error it wouldn't run on dev would it?

image

Both the CONTENTFUL_SPACE_ID and the CONTENTFUL_ACCESS_TOKEN are present, I've even added them directly to the Gatsby plugin to make sure it wasn't an .env thing.

I was hoping I could spin up something quickly to demo but it's being a bit tricky trying to figure out why it's not serving locally.

Ultimately I'd like to put this on our own server and build each time the content changes via a web hook.

So, I'm still in the proof of concept stage and not getting very far with this.

Is there something simpler I could use just to prove the concept?

Am I missing something?

The documentation only really covers Heroku and Netlify for some reason.

Thanks

Setting CONTENTFUL_HOST triggers access error

When I add CONTENTFUL_HOST to my env vars, I get the following error:

Accessing your Contentful space failed.
Try setting GATSBY_CONTENTFUL_OFFLINE=true to see if we can serve from cache.

Used options:
spaceId: "*********"
accessToken: "***************************************"
host: "preview.contentful.com"

If I remove CONTENTFUL_HOST it can access the space with no issues.

I set up my project using the setup script and I entered the Content Delivery API access token when it asked for it. However, in the contentful API settings there are two API tokens - delivery & preview. I am assuming that I'm getting this error because it needs to use the preview api token but there is nowhere to put the preview api token in the gatsby-config. There is only one spot for accessToken.

Running `npm run dev` results in GraphQL Error Unknown field `image` on type `ContentfulPerson`

How to reproduce

I was following the "Gatsby Starter for Contentful" getting started instructions. When running npm run dev it results in GraphQL Error Unknown field image on type ContentfulPerson.

  • Node v10.15.0
  • npm 6.9.0
  • Gatsby CLI version: 2.7.53
  • Gatsby version: 1.9.277

Log output

success delete html and css files from previous builds — 0.006 s
success open and validate gatsby-config — 0.007 s
success copy gatsby files — 0.028 s
success onPreBootstrap — 0.469 s
⠁ Starting to fetch data from Contentful
Fetching default locale
⢀ source and transform nodesdefault local is : en-US
⢀ source and transform nodescontentTypes fetched 2
Updated entries  4
Deleted entries  0
Updated assets  2
Deleted assets  0
Fetch Contentful data: 777.350ms
success source and transform nodes — 0.810 s
success building schema — 0.134 s
success createLayouts — 0.027 s
success createPages — 0.017 s
success createPagesStatefully — 0.011 s
success onPreExtractQueries — 0.002 s
success update schema — 0.075 s
GraphQL Error Unknown field `image` on type `ContentfulPerson`

  file: /Users/[removed-for-privacy-reasons]/starter-gatsby-blog/src/pages/index.js

  21 |       }
  22 |     }
  23 |     allContentfulPerson(filter: { id: { eq: "c15jwOBqpxqSAOy2eOO4S0m" } }) {
  24 |       edges {
  25 |         node {
  26 |           name
  27 |           shortBio {
  28 |             shortBio
  29 |           }
  30 |           title
> 31 |           heroImage: image {
     |                      ^
  32 |             sizes(
  33 |               maxWidth: 1180
  34 |               maxHeight: 480
  35 |               resizingBehavior: PAD
  36 |               background: "rgb:000000"
  37 |             ) {
  38 |               ...GatsbyContentfulSizes_withWebp
  39 |             }
  40 |           }
  41 |         }

success extract queries from components — 0.052 s
success run graphql queries — 0.008 s
success write out page data — 0.002 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.000 s

info bootstrap finished - 3.687 s

 DONE  Compiled successfully in 3204ms                                                                                          11:28:34


You can now view contentful-starter-gatsby-blog in the browser.

  http://localhost:8000/

View GraphiQL, an in-browser IDE, to explore your site's data and schema

  http://localhost:8000/___graphql

Note that the development build is not optimized.
To create a production build, use gatsby build

GraphQL Error Unknown field `image` on type `ContentfulPerson`

  file: /Users/[removed-for-privacy-reasons]/starter-gatsby-blog/src/pages/index.js

  21 |       }
  22 |     }
  23 |     allContentfulPerson(filter: { id: { eq: "c15jwOBqpxqSAOy2eOO4S0m" } }) {
  24 |       edges {
  25 |         node {
  26 |           name
  27 |           shortBio {
  28 |             shortBio
  29 |           }
  30 |           title
> 31 |           heroImage: image {
     |                      ^
  32 |             sizes(
  33 |               maxWidth: 1180
  34 |               maxHeight: 480
  35 |               resizingBehavior: PAD
  36 |               background: "rgb:000000"
  37 |             ) {
  38 |               ...GatsbyContentfulSizes_withWebp
  39 |             }
  40 |           }
>   41 |         }» npm run dev

README.md and hello.js reference contentful.json

Running npm run setup no longer saves space ID and API keys in contentful.json (it saves them in .env files).

However, the README and hello.js seem to be out of date and say that the configuration will be saved in contentful.json:

This project comes with a Contentful setup command npm run setup.

This command will ask you for a space ID, and access tokens for the Contentful Management and Delivery API and then import the needed content model into the space you define and write a config file (./.contentful.json).

${chalk.yellow.bold("npm run setup")} automates the following steps for you:
- creates a config file ${chalk.yellow("./.contentful.json")}
- imports ${chalk.green("a predefined content model")}

Although contentful.json is still sourced, it's confusing to see .env files generated when you're expecting to instead see contentful.json file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.