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

Updated Cloud Functions README to reflect package name #1896

Closed
wants to merge 4 commits into from
Closed

Updated Cloud Functions README to reflect package name #1896

wants to merge 4 commits into from

Conversation

travis-r6s
Copy link

@travis-r6s travis-r6s commented Oct 29, 2018

The package name was different to this README, so I have updated the latter to reflect the actual package name - apollo-server-cloud-functions

TODO:

  • Update CHANGELOG.md with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

The package name was different to this README, so I have updated the latter to reflect the actual package name - [apollo-server-cloud-function*s*](https://www.npmjs.com/package/apollo-server-cloud-functions)
@apollo-cla
Copy link

@thetre97: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@travis-r6s travis-r6s changed the title Updated to reflect package name Updated Cloud Functions README to reflect package name Oct 29, 2018
@pyrossh
Copy link
Contributor

pyrossh commented Nov 8, 2018

@thetre97 The package is not compiled to js and because of that I couldn't import it in my function. Did you find and way to make it work?

@travis-r6s
Copy link
Author

I used the NPM package, which is called apollo-server-cloud-functions, rather than 'apollo-server-cloud-function' (note the missing 's') as the guide says, hence I added this PR to update it.

So I did:

yarn add apollo-server-cloud-functions

and

const { ApolloServer, gql } = require('apollo-server-cloud-functions');

Then it worked fine with GC Functions Node8 runtime.

Not sure if that is what you mean?

@pyrossh
Copy link
Contributor

pyrossh commented Nov 8, 2018

Yes I know even I made the same PR for the README. Thanks.

What version of the package is it? This is how it looks for me. No index.js file.
ls node_modules/apollo-server-cloud-functions/src/
ApolloServer.ts tests googleCloudApollo.ts index.ts

This is the version "_id": "apollo-server-cloud-functions@2.2.0

@travis-r6s
Copy link
Author

Ah, i see - sorry.

I was just using version 2.1.0 and I had no problems with it - everything worked fine.
Not sure if 2.2.0 changed something?

@travis-r6s
Copy link
Author

travis-r6s commented Nov 8, 2018

You are right - have just upgraded my function to v2.2.0, and it throws this error -

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function load error: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'apollo-server-cloud-functions'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/srv/index.js:3:26)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

Try using v2.1.0 and see if it works for you? I downgraded to v2.1.0 again, and it deployed correctly.
I guess this is cause for an issue?

@abernix
Copy link
Member

abernix commented Nov 12, 2018

#1936 actually fixed most of these, but it appears that the actual directory for the package has been wrong since it was originally introduced in #1446. This has likely caused the problems you're seeing above. I'll fix that in another PR, but thanks for raising this!

@abernix abernix closed this Nov 12, 2018
abernix added a commit that referenced this pull request Nov 12, 2018
The `apollo-server-cloud-functions` has been been mis-referenced (or
referenced inconsistently) since its original inception in #1446 when its
package directory was `apollo-server-cloud-function` (singular!) and the
`package.json` referenced the plural form (`apollo-server-cloud-functions`):

724d9ff0#diff-e1d725fd66f7e9ef5251abf0437a09ca

These references have been mostly fixed in the READMEs and supporting
documentation, but the underlying monorepo directory structure has still not
been fixed, which I'm sure contributed to this module being overlooked and
unreferenced in the move to TypeScript project references in #1772.

Additionally, the lack of referencing in the monorepo's TS config has
resulted in it being broken in the most recent 2.2.0 release, as reported by
@pyros2097 and @thetre97 in: #1896 (comment)

This should fix that by properly adding the TypeScript project references.
@abernix
Copy link
Member

abernix commented Nov 12, 2018

See #1948 for the suspected solution to #1896 (comment). Thanks for reporting this!

abernix added a commit that referenced this pull request Nov 12, 2018
…1948)

* Add correct project references for `apollo-server-cloud-functions`.

The `apollo-server-cloud-functions` has been been mis-referenced (or
referenced inconsistently) since its original inception in #1446 when its
package directory was `apollo-server-cloud-function` (singular!) and the
`package.json` referenced the plural form (`apollo-server-cloud-functions`):

724d9ff0#diff-e1d725fd66f7e9ef5251abf0437a09ca

These references have been mostly fixed in the READMEs and supporting
documentation, but the underlying monorepo directory structure has still not
been fixed, which I'm sure contributed to this module being overlooked and
unreferenced in the move to TypeScript project references in #1772.

Additionally, the lack of referencing in the monorepo's TS config has
resulted in it being broken in the most recent 2.2.0 release, as reported by
@pyros2097 and @thetre97 in: #1896 (comment)

This should fix that by properly adding the TypeScript project references.

* Sorting.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants