Today I have updated Superface from 1.1.0 to the latest and got an error that `super.json` could not be found. Looking at the path, it has reverted back to the default one, despite the fact that I have set env var for `SUPERFACE_PATH` to properly find the settings. After testing multiple versions, this seems to be something that has crept up in 1.4. ## Expected Behavior Superface init should respect custom path to `super.json`. ## Current Behavior When setting custom path: ```js process.env.SUPERFACE_PATH = 'assets/app/superface/super.json' ``` I get the following error on startup: ```bash W20220525-16:44:13.668(2)? (STDERR) /home/storyteller/.meteor/packages/meteor-tool/.2.7.2.1gbfmsj.1hck++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280 W20220525-16:44:13.681(2)? (STDERR) throw(ex); W20220525-16:44:13.681(2)? (STDERR) ^ W20220525-16:44:13.681(2)? (STDERR) W20220525-16:44:13.681(2)? (STDERR) Unable to find super.json W20220525-16:44:13.682(2)? (STDERR) W20220525-16:44:13.682(2)? (STDERR) super.json not found in "/home/storyteller/Web/Literary-Universe/app/.meteor/local/build/programs/server/superface/super.json" W20220525-16:44:13.682(2)? (STDERR) Error: ENOENT: no such file or directory, stat '/home/storyteller/Web/Literary-Universe/app/.meteor/local/build/programs/server/superface/super.json' ``` ## Possible Solution I think this has to do with this part: https://github.com/superfaceai/one-sdk-js/blob/a948565c000188612d787a71cc2401650273934a/src/internal/superjson/superjson.ts#L51 Which combines the default path, but there is no way it is getting `SUPERFACE_PATH`. ## Steps to Reproduce Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant 1. Put `super.json` in another location 2. Set `SUPERFACE_PATH` env var to point to that location 3. Initialize SuperfaceClient 4. You should get an error ## Your Environment Include as many relevant details about the environment you experienced the bug in. Preferably include: * Version used: 1.4.1, works fine in 1.3.0 * Environment name and version (e.g. Node 8): Meteor. 2.7.2 * Operating System and version: Ubuntu 22.04
Last active 7 months ago
8 replies
30 views
- ST
Today I have updated Superface from 1.1.0 to the latest and got an error that
super.json
could not be found. Looking at the path, it has reverted back to the default one, despite the fact that I have set env var forSUPERFACE_PATH
to properly find the settings. After testing multiple versions, this seems to be something that has crept up in 1.4.Expected Behavior
Superface init should respect custom path to
super.json
.Current Behavior
When setting custom path:
process.env.SUPERFACE_PATH = 'assets/app/superface/super.json'
I get the following error on startup:
W20220525-16:44:13.668(2)? (STDERR) /home/storyteller/.meteor/packages/meteor-tool/.2.7.2.1gbfmsj.1hck++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280 W20220525-16:44:13.681(2)? (STDERR) throw(ex); W20220525-16:44:13.681(2)? (STDERR) ^ W20220525-16:44:13.681(2)? (STDERR) W20220525-16:44:13.681(2)? (STDERR) Unable to find super.json W20220525-16:44:13.682(2)? (STDERR) W20220525-16:44:13.682(2)? (STDERR) super.json not found in "/home/storyteller/Web/Literary-Universe/app/.meteor/local/build/programs/server/superface/super.json" W20220525-16:44:13.682(2)? (STDERR) Error: ENOENT: no such file or directory, stat '/home/storyteller/Web/Literary-Universe/app/.meteor/local/build/programs/server/superface/super.json'
Possible Solution
I think this has to do with this part:
https://github.com/superfaceai/one-sdk-js/blob/a948565c000188612d787a71cc2401650273934a/src/internal/superjson/superjson.ts#L51Which combines the default path, but there is no way it is getting
SUPERFACE_PATH
.Steps to Reproduce
Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant
- Put
super.json
in another location - Set
SUPERFACE_PATH
env var to point to that location - Initialize SuperfaceClient
- You should get an error
Your Environment
Include as many relevant details about the environment you experienced the bug in. Preferably include:
- Version used: 1.4.1, works fine in 1.3.0
- Environment name and version (e.g. Node 8): Meteor. 2.7.2
- Operating System and version: Ubuntu 22.04
- Put
- LU
Hi @StorytellerCZ,
thanks for reporting the issue. However, I can't reproduce it, it works correctly on 1.4.1 for me and looking at the code for path configuration, nothing changed between 1.1 and 1.4.1 (it's actually here). Did anything else change on your side that could help me pinpoint where the issue is? - JN
One common source of issues is the order of execution, since
process.env
is read only uponSuperfaceClient
initialization, but I assume that hasn't changed on @StorytellerCZ's side.Perhaps could you please rerun your with the debug output enabled? That's:
DEBUG='superface:*
- JN
Also @lukas-valenta, do I see it correctly that
detectSuperJson
method which was pointed out is a dead code? Doesn't seem to be called outside of the test. - LU
I think it's used in CLI
- TH
Found it. It's this change, which introduces a call to
Config.instance()
during import ofclient/profile-provider.ts
which is imported fromclient/client.ts
(which is whereSuperfaceClient
class is).https://github.com/superfaceai/one-sdk-js/commit/9640dff043adbf0cb3b777ab454e56b6b6e4e96e#diff-efa22419bafe5eec9887282cc51ebbf1611ff21246bc99dc1a9879eb6579a6e8R73
Workarounds:
1) If usingrequire
: by placing theprocess.env.SUPERFACE_PATH
before it. With native modules (where static imports and hoisted) this is not possible and must wait for a fix.process.env.SUPERFACE_PATH = "..."; const { SuperfaceClient } = require("@superfaceai/one-sdk");
2) A dirty hack: by using the internal API.
process.env.SUPERFACE_PATH = "..."; import { Config } from "@superfaceai/one-sdk/dist/config.js"; Config.reloadFromEnv();
- LU
Fixed in release 1.5.2
- ST
Today I have updated Superface from 1.1.0 to the latest and got an error that
super.json
could not be found. Looking at the path, it has reverted back to the default one, despite the fact that I have set env var forSUPERFACE_PATH
to properly find the settings. After testing multiple versions, this seems to be something that has crept up in 1.4.Expected Behavior
Superface init should respect custom path to
super.json
.Current Behavior
When setting custom path:
process.env.SUPERFACE_PATH = 'assets/app/superface/super.json'
I get the following error on startup:
W20220525-16:44:13.668(2)? (STDERR) /home/storyteller/.meteor/packages/meteor-tool/.2.7.2.1gbfmsj.1hck++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280 W20220525-16:44:13.681(2)? (STDERR) throw(ex); W20220525-16:44:13.681(2)? (STDERR) ^ W20220525-16:44:13.681(2)? (STDERR) W20220525-16:44:13.681(2)? (STDERR) Unable to find super.json W20220525-16:44:13.682(2)? (STDERR) W20220525-16:44:13.682(2)? (STDERR) super.json not found in "/home/storyteller/Web/Literary-Universe/app/.meteor/local/build/programs/server/superface/super.json" W20220525-16:44:13.682(2)? (STDERR) Error: ENOENT: no such file or directory, stat '/home/storyteller/Web/Literary-Universe/app/.meteor/local/build/programs/server/superface/super.json'
Possible Solution
I think this has to do with this part:
https://github.com/superfaceai/one-sdk-js/blob/a948565c000188612d787a71cc2401650273934a/src/internal/superjson/superjson.ts#L51Which combines the default path, but there is no way it is getting
SUPERFACE_PATH
.Steps to Reproduce
Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant
- Put
super.json
in another location - Set
SUPERFACE_PATH
env var to point to that location - Initialize SuperfaceClient
- You should get an error
Your Environment
Include as many relevant details about the environment you experienced the bug in. Preferably include:
- Version used: 1.4.1, works fine in 1.3.0
- Environment name and version (e.g. Node 8): Meteor. 2.7.2
- Operating System and version: Ubuntu 22.04
- Put
Last active 7 months ago
8 replies
30 views