Closed ahmadawais closed 5 years ago
It the track.js
file!
import Amplify, {Analytics} from 'aws-amplify';
- import awsmobile from '~/aws-exports'; // ← This is missing!
import {curry} from 'ramda';
// wiped on page refresh / non-pwa redirects
let configured = false;
const track = curry((name, attributes) => {
if (!configured) {
Amplify.configure(awsmobile);
configured = true;
}
Analytics.record({name, attributes});
});
export const internalPageView = props =>
track('internal page view', {href: props.location.href});
export const externalPageView = href => track('external page view', {href});
This project works using the Amplify CLI. To run a local copy you have to make a copy of the backend. So after cloning the repo you can run these commands:
amplify env add
? Do you want to use an existing environment? No
? Enter a name for the environment mysandbox
// Rest of init steps (around your AWS account)
$ amplify push
This setups up your own backend in AWS and also creates the aws-exports file when it is complete. You can read more about how multi-env works here.
So to work on a simple PR I'll have to create an entire backend in AWS in my personal account? That doesn't feel very nice. Is there a possibility of avoiding all that?
Hi @ahmadawais –– thank you for filing this issue. It’s been fixed. Please let us know if you run into any more trouble.
I can confirm, I am able to run locally without any changes now.
Thank you! 👌
Howdy, folks!
Awesome resource. I'd love to help with the site and start a meetup.
Have a couple of things I wanted to fix but am still unable to run the site locally with
yarn start
.ENTIRE LOG (CLICK TO EXPAND!)
```sh success open and validate gatsby-configs — 0.189 s success load plugins — 0.284 s success onPreInit — 0.948 s success initialize cache — 0.017 s success copy gatsby files — 0.103 s success onPreBootstrap — 0.014 s success source and transform nodes — 0.577 s success building schema — 0.417 s success createPages — 0.100 s success createPagesStatefully — 0.029 s success onPreExtractQueries — 0.003 s success update schema — 0.054 s warning The GraphQL query in the non-page component "/Users/ahmadawais/Documents/Web/Sandbox/awsamplify/src/templates/Event.js" will not be run. warning The GraphQL query in the non-page component "/Users/ahmadawais/Documents/Web/Sandbox/awsamplify/src/templates/Post.js" will not be run. Exported queries are only executed for Page components. It's possible you're trying to create pages in your gatsby-node.js and that's failing for some reason. If the failing component(s) is a regular component and not intended to be a page component, you generally want to use aSend halp :)