Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,733
Community Members
 
Community Events
165
Community Groups

Firebase Error: Specified "public" directory "out" does not exist, can't deploy hosting to site

Edited

Cannot deploy next js project to firebase, specified out folder in public directory of firebase.json, running next build && next export command, next export create out folder for prod files, in local out folder is generated and working file in bitbucket out folder is not found exen after prod build.

 

DEBUG: Starting new HTTPS connection (1): bitbucket.org:443
DEBUG: https://bitbucket.org:443 "GET /bitbucketpipelines/official-pipes/raw/master/pipes.prod.json HTTP/1.1" 200 None
INFO: Executing the pipe...
/main.py:60: DeprecationWarning: FIREBASE_TOKEN is deprecated due to its legacy. For better auth use google service account KEY_FILE
warnings.warn("FIREBASE_TOKEN is deprecated due to its legacy. "
INFO: Current NodeJS version:
installed : v16.15.0 (with npm 8.5.5)
INFO: Starting deployment of the project to Firebase.
[2022-05-26T11:10:34.369Z] > authorizing via --token option
[2022-05-26T11:10:34.370Z] [iam] checking project $PROJECT_ID for permissions ["firebase.projects.get","firebasehosting.sites.update"]
[2022-05-26T11:10:34.371Z] > refreshing access token with scopes: []
[2022-05-26T11:10:34.371Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[2022-05-26T11:10:34.445Z] <<< HTTP RESPONSE 200 {"expires":"Mon, 01 Jan 1990 00:00:00 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","pragma":"no-cache","date":"Thu, 26 May 2022 11:10:34 GMT","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[2022-05-26T11:10:34.448Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/$PROJECT_ID:testIamPermissions [none]
[2022-05-26T11:10:34.449Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/$PROJECT_ID:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2022-05-26T11:10:34.552Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/$PROJECT_ID:testIamPermissions {"permissions":["firebase.projects.get","firebasehosting.sites.update"]}
[2022-05-26T11:10:34.555Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/$PROJECT_ID [none]
[2022-05-26T11:10:34.561Z] <<< [apiv2][status] GET https://firebase-public.firebaseio.com/cli.json 200
[2022-05-26T11:10:34.562Z] <<< [apiv2][body] GET https://firebase-public.firebaseio.com/cli.json {"cloudBuildErrorAfter":1594252800000,"cloudBuildWarnAfter":1590019200000,"defaultNode10After":1594252800000,"minVersion":"3.0.5","node8DeploysDisabledAfter":1613390400000,"node8RuntimeDisabledAfter":1615809600000,"node8WarnAfter":1600128000000}
[2022-05-26T11:10:34.780Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/$PROJECT_ID 200
[2022-05-26T11:10:34.780Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/$PROJECT_ID {"projectId":"$PROJECT_ID","projectNumber":"860654096693","displayName":"Whatslink","name":"projects/$PROJECT_ID","resources":{"hostingSite":"$PROJECT_ID","realtimeDatabaseInstance":"$PROJECT_ID-default-rtdb","storageBucket":"$PROJECT_ID.appspot.com","locationId":"us-central"},"state":"ACTIVE"}
=== Deploying to '$PROJECT_ID'...
i deploying hosting
[2022-05-26T11:10:34.786Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/$PROJECT_ID [none]
[2022-05-26T11:10:34.947Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/$PROJECT_ID 200
[2022-05-26T11:10:34.947Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/$PROJECT_ID {"projectId":"$PROJECT_ID","projectNumber":"860654096693","displayName":"Whatslink","name":"projects/$PROJECT_ID","resources":{"hostingSite":"$PROJECT_ID","realtimeDatabaseInstance":"$PROJECT_ID-default-rtdb","storageBucket":"$PROJECT_ID.appspot.com","locationId":"us-central"},"state":"ACTIVE"}
Error: Specified "public" directory "out" does not exist, can't deploy hosting to site "whatslink"
✖ Deployment failed.
Build Output

+ umask 000

+ GIT_LFS_SKIP_SMUDGE=1 retry 6 git clone --branch="master" --depth 50 https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/$BITBUCKET_REPO_FULL_NAME.git $BUILD_DIR
Cloning into '/opt/atlassian/pipelines/agent/build'...

+ git reset --hard 701fc85b2c586a1d9ea793f4f40c10ca4b6f69dd
HEAD is now at 701fc85 modify https://bitbucket.org/whatslink/next_whatslink/src/701fc85b2c586a1d9ea793f4f40c10ca4b6f69dd/firebase.json and pipeline config

+ git config user.name bitbucket-pipelines

+ git config user.email commits-noreply@bitbucket.org

+ git config push.default current

+ git config http.${BITBUCKET_GIT_HTTP_ORIGIN}.proxy http://localhost:29418/

+ git remote set-url origin http://bitbucket.org/$BITBUCKET_REPO_FULL_NAME

+ git reflog expire --expire=all --all

+ echo ".bitbucket/pipelines/generated" >> .git/info/exclude

+ chmod 777 $BUILD_DIR

Images used:
build : docker.io/atlassian/default-image@sha256:edf4bd880adf9e7f7677094f7a1d944524c7f98e939550bc152523c5cf6080ff
+ npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but https://bitbucket.org/whatslink/next_whatslink/src/701fc85b2c586a1d9ea793f4f40c10ca4b6f69dd/package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> core-js@3.6.5 postinstall /opt/atlassian/pipelines/agent/build/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> protobufjs@6.11.3 postinstall /opt/atlassian/pipelines/agent/build/node_modules/protobufjs
> node scripts/postinstall


> nodemon@2.0.15 postinstall /opt/atlassian/pipelines/agent/build/node_modules/nodemon
> node bin/postinstall || exit 0

npm WARN whatslink@1.0.0 No description
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-win32-x64-msvc@12.1.5 (node_modules/@next/swc-win32-x64-msvc):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-win32-x64-msvc@12.1.5: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-win32-ia32-msvc@12.1.5 (node_modules/@next/swc-win32-ia32-msvc):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-win32-ia32-msvc@12.1.5: wanted {"os":"win32","arch":"ia32"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-win32-arm64-msvc@12.1.5 (node_modules/@next/swc-win32-arm64-msvc):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-win32-arm64-msvc@12.1.5: wanted {"os":"win32","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-linux-arm64-musl@12.1.5 (node_modules/@next/swc-linux-arm64-musl):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-linux-arm64-musl@12.1.5: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-linux-arm64-gnu@12.1.5 (node_modules/@next/swc-linux-arm64-gnu):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-linux-arm64-gnu@12.1.5: wanted {"os":"linux","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-linux-arm-gnueabihf@12.1.5 (node_modules/@next/swc-linux-arm-gnueabihf):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-linux-arm-gnueabihf@12.1.5: wanted {"os":"linux","arch":"arm"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-darwin-x64@12.1.5 (node_modules/@next/swc-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-darwin-x64@12.1.5: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-darwin-arm64@12.1.5 (node_modules/@next/swc-darwin-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-darwin-arm64@12.1.5: wanted {"os":"darwin","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-android-arm64@12.1.5 (node_modules/@next/swc-android-arm64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-android-arm64@12.1.5: wanted {"os":"android","arch":"arm64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @Next/swc-android-arm-eabi@12.1.5 (node_modules/@next/swc-android-arm-eabi):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @Next/swc-android-arm-eabi@12.1.5: wanted {"os":"android","arch":"arm"} (current: {"os":"linux","arch":"x64"})

added 579 packages from 321 contributors and audited 590 packages in 21.687s

76 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities


+ npm run out

> whatslink@1.0.0 out /opt/atlassian/pipelines/agent/build
> next build && next export

warn - Detected next.config.js, no exported configuration found. https://nextjs.org/docs/messages/empty-configuration
warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

info - Checking validity of types...
warn - No ESLint configuration detected. Run next lint to begin setup
info - Creating an optimized production build...
info - Compiled successfully
info - Collecting page data...
Warning: You have opted-out of Automatic Static Optimization due to `getInitialProps` in `pages/_app`. This does not opt-out pages with `getStaticProps`
Read more: https://nextjs.org/docs/messages/opt-out-auto-static-optimization

Page Size First Load JS
┌ λ / 1.41 kB 177 kB
├ /_app 0 B 163 kB
├ λ /404 1.8 kB 178 kB
├ λ /dashboard 952 B 177 kB
├ λ /mobile-app 2.54 kB 178 kB
├ λ /open-chat 15.3 kB 191 kB
├ └ css/29dd92ea5b35c4bf.css 2.85 kB
├ λ /Policies/PrivacyPolicy 2.86 kB 179 kB
├ λ /Policies/Terms 3 kB 179 kB
├ λ /saved-links 665 B 176 kB
└ λ /short-links 664 B 176 kB
+ First Load JS shared by all 163 kB
├ chunks/framework-5f4595e5518b5600.js 42 kB
├ chunks/main-779b41245c009d2a.js 28.3 kB
├ chunks/pages/_app-d7a8b6b489fa8365.js 91.3 kB
├ chunks/webpack-9b312e20a4e32339.js 836 B
└ css/9473410fd58606b5.css 13.3 kB

λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)

warn - Detected next.config.js, no exported configuration found. https://nextjs.org/docs/messages/empty-configuration
info - using build directory: /opt/atlassian/pipelines/agent/build/.next
info - Copying "static build" directory
info - No "exportPathMap" found in "/opt/atlassian/pipelines/agent/build/next.config.js". Generating map from "./pages"
info - Launching 7 workers
info - Exporting (0/9)
info - Copying "public" directory
info - Exporting (2/9)
info - Exporting (4/9)
info - Exporting (6/9)
info - Exporting (9/9)
Export successful. Files written to /opt/atlassian/pipelines/agent/build/out
Searching for files matching artifact pattern build/**

Searching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

1 answer

Hi @Saurabh Chandravanshi 

Thank you for your question!

It would be nice if you provide us with details config bitbucket-pipelines.yml file.

 

Best regards,
Oleksandr Kyrdan


image: atlassian/default-image:3

pipelines:
branches:
master:
- parallel:
- step:
name: 'Build'
script:
- npm install
- npm run out # this means next build && next export
artifacts:
- build/**
- step:
name: 'Deployment to Production'
deployment: production
script:
- pipe: atlassian/firebase-deploy:2.0.0
variables:
FIREBASE_TOKEN: $FIREBASE_TOKEN
PROJECT_ID: $PROJECT_ID
MESSAGE: 'Deploying <Project>'
EXTRA_ARGS: '--only hosting:<Project>'
DEBUG: 'true'

You are running the export step along the deployment, which can't have the file since it's not made before the steps.

 

Make them run one by one and not parallel

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,111 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you