Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverless asset compatibility (e.g. Firebase) #7758

Closed
wants to merge 5 commits into from

Conversation

Timer
Copy link
Member

@Timer Timer commented Jul 5, 2019

This pull request integrates a few weeks worth of work on @zeit/webpack-asset-relocator-loader to get it ready for usage in Next.js. 🙏

Notably, this pull request allows Firebase to work out of the box with Serverless!

This will likely be landed after Next.js 9.0.0 is released. It's missing its companion @now/next PR.


Closes #7512
Closes #7391
Closes #6655
Closes #7821
Closes #7933
Supersedes #6073

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2019

Stats from current PR

Click to expand stats
zeit/next.js canary Timer/next.js firebase-compat Change
Build Duration 14.6s 14.5s -150ms
node_modules Size 45.3 MB 46.7 MB ⚠️ +1.38 MB
Total Bundle (main, webpack, commons) Size 210 kB 210 kB
Total Bundle (main, webpack, commons) gzip Size 68.9 kB 68.9 kB
Client _app Size 2.39 kB 2.39 kB
Client _app gzip Size 1.08 kB 1.08 kB
Client _error Size 8.45 kB 8.45 kB
Client _error gzip Size 3.24 kB 3.24 kB
Client pages/index Size 296 B 296 B
Client pages/index gzip Size 222 B 222 B
Client pages/link Size 4.74 kB 4.74 kB
Client pages/link gzip Size 2.02 kB 2.02 kB
Client pages/routerDirect Size 411 B 411 B
Client pages/routerDirect gzip Size 296 B 296 B
Client pages/withRouter Size 393 B 393 B
Client pages/withRouter gzip Size 280 B 280 B
Client main Size 24.3 kB 24.3 kB
Client main gzip Size 7.97 kB 7.97 kB
Client commons Size 183 kB 183 kB
Client commons gzip Size 59.6 kB 59.6 kB
Client webpack Size 1.49 kB 1.49 kB
Client webpack gzip Size 770 B 770 B
Base Rendered Size 1.36 kB 1.36 kB
Build Dir Size 744 kB 744 kB
Click to expand serverless stats
zeit/next.js canary Timer/next.js firebase-compat Change
Build Duration 16.4s 18s ⚠️ +1.6s
node_modules Size 45.3 MB 46.7 MB ⚠️ +1.38 MB
Total Bundle (main, webpack, commons) Size 210 kB 210 kB
Total Bundle (main, webpack, commons) gzip Size 68.9 kB 68.9 kB
Client _app Size 2.39 kB 2.39 kB
Client _app gzip Size 1.08 kB 1.08 kB
Client _error Size 8.45 kB 8.45 kB
Client _error gzip Size 3.24 kB 3.24 kB
Client pages/index Size 296 B 296 B
Client pages/index gzip Size 222 B 222 B
Client pages/link Size 4.74 kB 4.74 kB
Client pages/link gzip Size 2.02 kB 2.02 kB
Client pages/routerDirect Size 411 B 411 B
Client pages/routerDirect gzip Size 296 B 296 B
Client pages/withRouter Size 393 B 393 B
Client pages/withRouter gzip Size 280 B 280 B
Client main Size 24.3 kB 24.3 kB
Client main gzip Size 7.97 kB 7.97 kB
Client commons Size 183 kB 183 kB
Client commons gzip Size 59.6 kB 59.6 kB
Client webpack Size 1.49 kB 1.49 kB
Client webpack gzip Size 770 B 770 B
Serverless pages/link Size Error getting size Error getting size
Serverless pages/link gzip Size Error getting size Error getting size
Serverless pages/index Size Error getting size Error getting size
Serverless pages/index gzip Size Error getting size Error getting size
Serverless pages/_error Size 329 kB 329 kB ⚠️ +62 B
Serverless pages/_error gzip Size 84.1 kB 84.1 kB ⚠️ +5 B
Serverless pages/routerDirect Size Error getting size Error getting size
Serverless pages/routerDirect gzip Size Error getting size Error getting size
Serverless pages/withRouter Size Error getting size Error getting size
Serverless pages/withRouter gzip Size Error getting size Error getting size
Build Dir Size 1.05 MB 1.05 MB ⚠️ +62 B

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2019

Stats from current PR

Click to expand stats
zeit/next.js canary Timer/next.js firebase-compat Change
Build Duration 14.1s 13.4s -640ms
node_modules Size 45.4 MB 46.8 MB ⚠️ +1.38 MB
Total Bundle (main, webpack, commons) Size 210 kB 210 kB
Total Bundle (main, webpack, commons) gzip Size 68.9 kB 68.9 kB
Client _app Size 2.39 kB 2.39 kB
Client _app gzip Size 1.08 kB 1.08 kB
Client _error Size 8.45 kB 8.45 kB
Client _error gzip Size 3.24 kB 3.24 kB
Client pages/index Size 296 B 296 B
Client pages/index gzip Size 222 B 222 B
Client pages/link Size 4.74 kB 4.74 kB
Client pages/link gzip Size 2.02 kB 2.02 kB
Client pages/routerDirect Size 411 B 411 B
Client pages/routerDirect gzip Size 296 B 296 B
Client pages/withRouter Size 393 B 393 B
Client pages/withRouter gzip Size 280 B 280 B
Client main Size 24.3 kB 24.3 kB
Client main gzip Size 7.97 kB 7.97 kB
Client commons Size 183 kB 183 kB
Client commons gzip Size 59.6 kB 59.6 kB
Client webpack Size 1.49 kB 1.49 kB
Client webpack gzip Size 770 B 770 B
Base Rendered Size 1.36 kB 1.36 kB
Build Dir Size 744 kB 744 kB
Click to expand serverless stats
zeit/next.js canary Timer/next.js firebase-compat Change
Build Duration 15.2s 16.7s ⚠️ +1.5s
node_modules Size 45.4 MB 46.8 MB ⚠️ +1.38 MB
Total Bundle (main, webpack, commons) Size 210 kB 210 kB
Total Bundle (main, webpack, commons) gzip Size 68.9 kB 68.9 kB
Client _app Size 2.39 kB 2.39 kB
Client _app gzip Size 1.08 kB 1.08 kB -1 B
Client _error Size 8.45 kB 8.45 kB
Client _error gzip Size 3.24 kB 3.24 kB
Client pages/index Size 296 B 296 B
Client pages/index gzip Size 222 B 224 B ⚠️ +2 B
Client pages/link Size 4.74 kB 4.74 kB
Client pages/link gzip Size 2.02 kB 2.02 kB -1 B
Client pages/routerDirect Size 411 B 411 B
Client pages/routerDirect gzip Size 296 B 296 B
Client pages/withRouter Size 393 B 393 B
Client pages/withRouter gzip Size 280 B 280 B
Client main Size 24.3 kB 24.3 kB
Client main gzip Size 7.97 kB 7.97 kB -1 B
Client commons Size 183 kB 183 kB
Client commons gzip Size 59.6 kB 59.6 kB
Client webpack Size 1.49 kB 1.49 kB
Client webpack gzip Size 770 B 770 B
Serverless pages/link Size Error getting size Error getting size
Serverless pages/link gzip Size Error getting size Error getting size
Serverless pages/index Size Error getting size Error getting size
Serverless pages/index gzip Size Error getting size Error getting size
Serverless pages/_error Size 329 kB 329 kB ⚠️ +62 B
Serverless pages/_error gzip Size 84.1 kB 84.1 kB ⚠️ +8 B
Serverless pages/routerDirect Size Error getting size Error getting size
Serverless pages/routerDirect gzip Size Error getting size Error getting size
Serverless pages/withRouter Size Error getting size Error getting size
Serverless pages/withRouter gzip Size Error getting size Error getting size
Build Dir Size 1.05 MB 1.05 MB ⚠️ +62 B

@skaptox
Copy link

skaptox commented Jul 9, 2019

Hello, Will it solve this issue?

#7821

@anthonyrenard
Copy link

Hello, someone have an idea when this will be released ? :-)

@Ciberusps
Copy link

👀

@Pushplaybang
Copy link

as per #8052 this seems to relate to issues loading jimp as well as react-ssr-prepass

@Pushplaybang
Copy link

I hate to be that guy, but I have a client with his hair on fire because I can't deploy, is there ANYTHING I can do to help this along?

  • testing?
  • merge conflict?
  • backrub?

@Ciberusps
Copy link

Ciberusps commented Jul 22, 2019

Not sure but @Pushplaybang u can implement same by your own just check how this PR works in files
U will need zeit/webpack-asset-relocator-loader
P.S. correct me if im wrong

@Timer
Copy link
Member Author

Timer commented Jul 22, 2019

@Pushplaybang you can follow these instructions for the time being: #6073 (comment)

@Pushplaybang
Copy link

Pushplaybang commented Jul 23, 2019

@Timer the workaround in #6073 does not fix the issue mentioned in #8052 which is what led me here, Once thats applied it fixes the grpc issue, and then I receive the following:

Jul 23 2019 09:33:28:793 | ...package.json | Module not found: Can't resolve 'iconv' in '/tmp/6c75a54f/node_modules/encoding/lib'
-- | -- | --
Jul 23 2019 09:33:29:413 | ...package.json | Warning: You have opted-out of Automatic Prerendering due to `getInitialProps` in `pages/_app`.
Jul 23 2019 09:33:29:413 | ...package.json | Read more: https://err.sh/next.js/opt-out-automatic-prerendering
Jul 23 2019 09:33:30:462 | ...package.json | > Build error occurred
Jul 23 2019 09:33:30:464 | ...package.json | { Error: Failed to load /tmp/6c75a54f/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node. Module did not self-register.
Jul 23 2019 09:33:30:464 | ...package.json | at Object.Module._extensions..node (internal/modules/cjs/loader.js:730:18)
Jul 23 2019 09:33:30:464 | ...package.json | at Module.load (internal/modules/cjs/loader.js:600:32)
Jul 23 2019 09:33:30:464 | ...package.json | at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
Jul 23 2019 09:33:30:464 | ...package.json | at Function.Module._load (internal/modules/cjs/loader.js:531:3)
Jul 23 2019 09:33:30:464 | ...package.json | at Module.require (internal/modules/cjs/loader.js:637:17)
Jul 23 2019 09:33:30:464 | ...package.json | at require (internal/modules/cjs/helpers.js:22:18)
Jul 23 2019 09:33:30:464 | ...package.json | at Object.<anonymous> (/tmp/6c75a54f/node_modules/grpc/src/grpc_extension.js:32:13)
Jul 23 2019 09:33:30:464 | ...package.json | at Module._compile (internal/modules/cjs/loader.js:701:30)
Jul 23 2019 09:33:30:464 | ...package.json | at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
Jul 23 2019 09:33:30:464 | ...package.json | at Module.load (internal/modules/cjs/loader.js:600:32) type: 'Error', '$error': '$error' }

I have tried with both the specified version of the asset relocator, and the latest version

Please let me know if this is helpful in the context of this PR or if we should re-open #8052

@Timer
Copy link
Member Author

Timer commented Jul 23, 2019

@Pushplaybang I don't think it's worth tracking these individually -- the latest version of these plugins have better static analysis capability (which should fix cases like iconv).
Once this is landed we can start to worry about specific incompatibilities.

However, only versions 0.5.x are compatible with Next.js at the moment -- we're working on integrating the latest version in this PR.

@Pushplaybang
Copy link

@Timer great, having applied the fix mentioned with the asset relocator is what I've been using for some time, though I'm still blocked on deployment having upgraded to v9. As you;ve closed one issue, and marked another comment as spam, could you please advise:

  • is there a current workaround,
  • should I attempt to use this branch
  • should I open another separate issue regarding iconv?

just to reiterate, I was able to deploy prior to v9. Please tell me how I can either assist, or get help with this issue.

@kodiakhq
Copy link
Contributor

kodiakhq bot commented Jul 25, 2019

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

4 similar comments
@kodiakhq
Copy link
Contributor

kodiakhq bot commented Jul 25, 2019

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@kodiakhq
Copy link
Contributor

kodiakhq bot commented Jul 25, 2019

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@kodiakhq
Copy link
Contributor

kodiakhq bot commented Jul 25, 2019

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@kodiakhq
Copy link
Contributor

kodiakhq bot commented Jul 25, 2019

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@Vista1nik
Copy link

Hello. Any progress on this?

@Timer
Copy link
Member Author

Timer commented Jul 30, 2019

No progress to report. It has been prioritized to be done soon, however.

@Timer Timer mentioned this pull request Aug 5, 2019
5 tasks
@Timer Timer closed this in #8246 Aug 5, 2019
@Timer Timer deleted the firebase-compat branch August 5, 2019 22:39
@Timer Timer modified the milestones: 9.0.x, 9.0.4 Aug 8, 2019
@Timer
Copy link
Member Author

Timer commented Aug 8, 2019

The latest Next.js canary should now work with Firebase when deployed to Now with the @now/next@canary builder! 😄

@antonnyman
Copy link

I'm still getting the error

Module not found: Can't resolve 'request' in '/tmp/e991867/node_modules/@firebase/database/dist'

on @now/next@canary with "firebase": "^6.2.4"

@Timer
Copy link
Member Author

Timer commented Aug 8, 2019

@antonmoiseev you have not provided any information for us to help diagnose this issue. We have integration tests ensuring firebase works, so we need to see your specific setup. Please open a new issue with a reproduction.

@vercel vercel locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.