Hi!
I’m trying to deploy my company’s site and I’m getting this error:
TypeError: Cannot read property 'fsPath' of undefined
2020-02-07T12:33:50.534Z at Object.build (/zeit/b027f802d99b8095/.build-utils/.builder/node_modules/@frontity/now/dist/index.js:95:49)
2020-02-07T12:33:50.534Z at async buildStep (/var/task/sandbox-worker.js:20292:20)
2020-02-07T12:33:50.534Z at async mainSub (/var/task/sandbox-worker.js:20047:9)
2020-02-07T12:33:50.534Z at async main (/var/task/sandbox-worker.js:19975:5)
Here is my now.json file:
{
"version": 2,
"builds": [
{
"src": "api/*.js",
"use": "@now/node"
},
{
"src": "package.json",
"use": "@frontity/now"
}
],
"routes": [
{
"src": "/certificacao-digital",
"status": 308,
"headers": { "Location": "/certificados-digitais/" }
},
{
"src": "/framework",
"status": 308,
"headers": { "Location": "/bry-framework/" }
},
{
"src": "/certificado-de-atributos",
"status": 308,
"headers": { "Location": "/bry-atributos/" }
},
{ "src": "/api/(.*)", "methods": ["GET"], "status": 404 },
{
"src": "/api/(.*)",
"headers": { "cache-control": "no-cache" },
"dest": "/api/$1.js"
},
{
"src": "/static/(.*)",
"headers": {
"cache-control": "public,max-age=31536000,immutable"
},
"dest": "/static/$1"
},
{ "src": "/favicon.ico", "dest": "favicon.ico" },
{
"src": "($|/.*)",
"headers": {
"cache-control": "s-maxage=1,stale-while-revalidate"
},
"dest": "/server.js"
}
],
"build": {
"env": {
"SSH_PRIVATE_KEY": "@gitlab-ssh-key-react-ui-components"
}
}
}
I think that this error was generated after I inserted an build env variable.
Here is my gitlab-ci.yml:
image: node
before_script:
- "which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )"
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
stages:
- setup
- test
- deploy
setup:
stage: setup
script:
- npm install
- npm run build
test:
stage: test
script: npm test
deploy_staging:
stage: deploy
script:
- npm i -g now --silent
- npm install
- npm run build
- now -e NODE_ENV=staging --token=${NOW_TOKEN}
- now alias site2020.bry.now.sh --token=${NOW_TOKEN}
environment:
name: staging
url: https://site2020.bry.now.sh
only:
- master
deploy_prod:
stage: deploy
script:
- npm i -g now --silent
- npm install
- npm run build
- now -e NODE_ENV=production --token=${NOW_TOKEN}
- now alias site2020-puce-one.now.sh --token=${NOW_TOKEN}
environment:
name: production
url: https://site2020-puce-one.now.sh
only:
- master