Why am I getting an 'ERR_MODULE_NOT_FOUND' error when attempting to import the microsoft_outlook app into a custom codestay using Pipedream?

This topic was automatically generated from Slack. You can find the original thread here.

I’m trying to import the microsoft_outlook app into a custom codestep

import microsoftOutlook from "@pipedream/microsoft_outlook";

it’s returning the following error

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@pipedream/platform' imported from /tmp/tmp-.../.../node_modules/@pipedream/microsoft_outlook/microsoft_outlook.app.mjs

It looks like you’re trying to import the Microsoft Outlook app directly in your code. However, you don’t need to import the app like that. Instead, you should use the props property in your Pipedream component to connect your Microsoft Outlook account. Here’s an example: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { microsoft_outlook: { type: "app", app: "microsoft_outlook", }, }, async run({ steps, $ }) { // Your code here, using this.microsoft_outlook.$auth.oauth_access_token for authentication }, }); In this example, the microsoft_outlook prop allows you to connect your Microsoft Outlook account. You can then use this.microsoft_outlook.$auth.oauth_access_token for authentication in your API requests.

that is not correct, I’m intentionally importing the app since I would like to use existing functions built for the app.
Answer the original question please.

I apologize for the confusion earlier. It seems you’re trying to import the Microsoft Outlook app directly in a custom code step. However, this approach is not supported in Pipedream. The app code is not designed to be imported and used directly in custom code steps. Instead, you can use the Microsoft Outlook API directly by making API calls using the axios package. You can use the this.microsoft_outlook.$auth.oauth_access_token for authentication in your API requests if you have connected your Microsoft Outlook account using the props property in your Pipedream component. If you need help with specific API calls or functionality, please let me know, and I’ll be happy to assist you.

does this makes sense?

Just seems like a bug to me when trying to import '@pipedream/platform' as a subdependancy

this works fine and with other apps as well

import gmail from "@pipedream/gmail";

this is a bug, @pipedream/platform isn’t a dependency in the package.json file for that package. That doesn’t affect running components but if will throw the error you if you import from npm directly like that. I’m fixing and will let you know when it’s done

Amazing, thanks :pray: :fire:

@pipedream/microsoft_outlook@0.0.10

should be out and fixed on that version of the package

btw Pi failed badly on this earlier because we actually don’t have docs on using methods / props from packages like this, so we just need to add that and it should provide more accurate answers on the use case in general (wouldn’t have caught the bug)

I want to train it on the full GitHub repo so that it can find bugs like this though

Great, thanks for the quick handling! Useful insight.

I have a few components where I used the existing components code as a baseline with a couple minor tweaks and just had to fix the imports. Can share them if it will help for the training.

that might be useful for the code gen service we’re developing, like I’d love to see if that works to do these edits. We also need to have that consult the existing methods / props on an app file (it doesn’t use those today)