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

Corrupted packages file generated at build #58

Open
ghost opened this issue Jul 11, 2019 · 11 comments
Open

Corrupted packages file generated at build #58

ghost opened this issue Jul 11, 2019 · 11 comments

Comments

@ghost
Copy link

ghost commented Jul 11, 2019

When I run pub run build_runner build --output=build as admin (#56), the corrupted file functions/build/node/packages is generated.

If I run firebase deploy --debug --only functions, I get the following error:

[2019-07-11T18:19:46.508Z] <<< HTTP RESPONSE 200 content-type=application/json; charset=UTF-8, vary=X-Origin, Referer, Origin,Accept-Encoding, date=Thu, 11 Jul 2019 18:19:46 GMT, server=ESF, cache-contro
l=private, x-xss-protection=0, x-frame-options=SAMEORIGIN, x-content-type-options=nosniff, alt-svc=quic=":443"; ma=2592000; v="46,43,39", accept-ranges=none, transfer-encoding=chunked
[2019-07-11T18:19:46.934Z] Error: EPERM: operation not permitted, stat 'C:\Users\hugoc\IdeaProjects\Flutter\buster\functions\build\node\packages'

Error: Could not read source directory. Remove links and shortcuts and try again.

After deleting packages, I'm able to deploy.

I'm using the exact pubspec.yaml, node/index.dart and build.yaml, as shown in the readme.

@gazialankus
Copy link
Contributor

gazialankus commented Aug 24, 2019

I just ran into this as well in Windows. Back in the day that file was a junction with an absolute path reference. Now it's a symlink with a relative path reference and it does not work. Not sure what should be done.

@gazialankus
Copy link
Contributor

This is probably why we're running into this problem. dart-lang/sdk#33966
dart:io's Link.create used to create junctions but now creates symlinks in Windows.

Firebase CLI does not seem to like symlinks. I guess we could add a npm postbuild command that replaces build/node/packages with a junction.

Not sure who is creating the build/node/packages symlink, anyway. It is created after pub run build_runner build --output=build but I'm not sure where exactly is the link creating code.

@basketball-ico
Copy link

@hugocbpassos @gazialankus i am new with this package and node, can you show me a example project? i can't setup a readme example :(

@gazialankus
Copy link
Contributor

@basketball-ico StackOverflow is probably better for this. The readme file is quite sufficient, actually. Ask in SO and we can answer in more detail.

@basketball-ico
Copy link

@gazialankus Thanks, i have the same issue here and ##56 , which version of dart I need to use to make this work? i really want to test it

@gazialankus
Copy link
Contributor

I'm using Dart 2.3.2, I didn't try 2.4.0.

@basketball-ico
Copy link

basketball-ico commented Sep 2, 2019

@gazialankus I tested with Dart 2.1 - 2.2 - 2.3.2 - 2.41 - 2.5.0.2-dev-1
And ever get this errors
fail

@gazialankus
Copy link
Contributor

Wow you really tried all versions, huh. I'm sorry you're having this issue. I use IntelliJ, not VS Code. Did you really try the steps here one by one? https://github.com/pulyaevskiy/firebase-functions-interop/blob/master/README.md Could you try on the command line rather than VS Code?

@basketball-ico
Copy link

@gazialankus yes, check https://github.com/basketball-ico/functions_test-
Also I test on the command line and is the same of run in vs code
and pub run build_runner build --output=build not have problems in console, but the files in package folder have errors.

Also if I run pub run build_runner build --output=build second time I got this like #56 :

FileSystemException: Cannot create link, path = 'build\node\packages' (OS Error: A required privilege is not held by the client.
, errno = 1314)

I solve with administrator command line but why I need to run this in an Administrator Command line?

and when try firebase deploy --only functions i got

Error: Could not read source directory. Remove links and shortcuts and try again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ deploy: `firebase deploy --only functions`
npm ERR! Exit status 1

dart 2.3.2

Also if I remove the build/node/packages.symlink I can deploy but it take some time to deploying it is only a simple function and have 37.9 MB like #57

i  deploying functions
i  functions: ensuring necessary APIs are enabled...
+  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (37.9 MB) for uploading
+  functions: functions folder uploaded successfully
i  functions: updating Node.js 8 function helloWorld(us-central1)...
+  functions[helloWorld(us-central1)]: Successful update operation.

+  Deploy complete!

Thanks, please help me 🤗

@gazialankus
Copy link
Contributor

This is what at also have. I remove the packages symlink and I also get a huge upload like 40mb.

I'm able to use IntelliJ but I don't know about VS Code. I think the only real issue you have is about running it locally. You run it using npm. After adding this https://github.com/pulyaevskiy/firebase-functions-interop/blob/master/README.md#7-scripts-optional you can say npm serve or npm run serve (forgot which) and you can run locally.

If you fix your IDE, you will be same as what I have here...

@basketball-ico
Copy link

@gazialankus I solve the error of VScode by excluding the build folder for analysis like https://github.com/pulyaevskiy/firebase-functions-interop/blob/master/analysis_options.yaml,

This is good?

But i can't deploy

Error: Could not read source directory. Remove links and shortcuts and try again.

what is the solution you said

Firebase CLI does not seem to like symlinks. I guess we could add a npm postbuild command that replaces build/node/packages with a junction.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants